English 中文(简体)
1. 无序号
原标题:No module named serial
  • 时间:2015-10-21 18:54:34
  •  标签:
  • python

我在拿我的手法时,就谈了一个问题。

I installed Python 2.7 on Windows 7, bit 64. I got an error "No module named serial" when I compiled my code:

import serial

ser = serial.Serial("COM5", 9600)

ser.write("Hello world")

x = ser.readline()

print(x)

I tried many ways to crack this problem, such as installed Canopy to setup virtual environment, make sure pip is there, no Python v 3.x installed. But still cannot get it out.

任何建议都会得到赞赏。

问题回答

Serial is not included with-030. 这是你需要单独安装的一揽子方案。

Since you have pip installed you can install serial from the command line with:

pip install pyserial

或者,您可从 。 它希望你再次使用3号,这样就点击了3号安装机。

然后,你就能够进口你此前所尝试的序列。

页: 1

第一次使用指挥

pip uninstall pyserial

Then run again

 pip install pyserial

上述指挥系统将配备系统口译员。

在我的案件中,以下指挥官做了工作:

pip3 install pyserial
sudo apt install python-serial python3-serial

将其处理完毕,将其用于Esp32

https://pypi.python.org/ Packages/1f/3b/ee6f354bc1e28a7cd735be98f39ecf805549484b41e9f79651befa6/pys-3.2.1.tar.gz#md5d5=7142a421c8b354245b2b2。

cd /opt
sudo tar -xvf ~/Downloads/pyserial-3.2.1.tar.gz -C .
cd /opt/pyserial-3.2.1 
sudo python setup.py install 

I had this same problem multiple times but finally found solution.

我安装了多台沙里。 同Raspberry Pi一样,有人安放了Adhur3.5,我还安装了3.9.2套,没有安装3.5套。 然后,我安装了有镜头并尝试了我的节目。 无模块 但是,理由是,python3中的气球象征联系指Python3.9.2版本,但pip3则指python3.5。 因此,在Python3.5安装了玩具,在Python3.9.2的操作中,无法理解。 然后,我把第3页的象征意义改为右版和沃伊拉,所有东西都做不起!

  1. Firstly uninstall pyserial using the command pip uninstall pyserial
  2. Then go to https://www.lfd.uci.edu/~gohlke/pythonlibs/
  3. download the suitable pyserial version and then go to the directory where the file is downloaded and open cmd there
  4. then type pip install "filename"(without quotes)

对我表示高兴。 Some断了。 提出的所有解决办法都是徒劳的。

sudo pip install serial Requirement already satisfied: serial in /usr/local/lib/python3.8/dist-packages (0.0.97)

sudo pip3 install serial Requirement already satisfied: serial in /usr/local/lib/python3.8/dist-packages (0.0.97)

Same for pyserial, it was already installed.

解决办法: 我替换了使用Python3而不是python2的象征联系。

通常情况下,与我的情况一样,手工安装新版本能够将宇宙的位置从最低程度改为升级版本。

例如,在安装Arduino IDE之前,我刚刚安装了3,10枚,这只是造成问题重重。

I uninstalled pyserial by trying pip uninstall and then

页: 1

sudo apt purge python3.10

之后,我安装了ip,然后又安装了erial,这是trick的。

当有人用 su子 ran倒时,我发现这种错误,用 su子重新安装了细菌,帮助我:

sudo pip3 install pyserial

Link: https://blog.finxter.com/modulenotfounderror-no-module-named-serial-in-python/





相关问题
Can Django models use MySQL functions?

Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to produce something like ...

An enterprise scheduler for python (like quartz)

I am looking for an enterprise tasks scheduler for python, like quartz is for Java. Requirements: Persistent: if the process restarts or the machine restarts, then all the jobs must stay there and ...

How to remove unique, then duplicate dictionaries in a list?

Given the following list that contains some duplicate and some unique dictionaries, what is the best method to remove unique dictionaries first, then reduce the duplicate dictionaries to single ...

What is suggested seed value to use with random.seed()?

Simple enough question: I m using python random module to generate random integers. I want to know what is the suggested value to use with the random.seed() function? Currently I am letting this ...

How can I make the PyDev editor selectively ignore errors?

I m using PyDev under Eclipse to write some Jython code. I ve got numerous instances where I need to do something like this: import com.work.project.component.client.Interface.ISubInterface as ...

How do I profile `paster serve` s startup time?

Python s paster serve app.ini is taking longer than I would like to be ready for the first request. I know how to profile requests with middleware, but how do I profile the initialization time? I ...

Pragmatically adding give-aways/freebies to an online store

Our business currently has an online store and recently we ve been offering free specials to our customers. Right now, we simply display the special and give the buyer a notice stating we will add the ...

Converting Dictionary to List? [duplicate]

I m trying to convert a Python dictionary into a Python list, in order to perform some calculations. #My dictionary dict = {} dict[ Capital ]="London" dict[ Food ]="Fish&Chips" dict[ 2012 ]="...

热门标签