pyserial, ImportError: No module named serial

强颜欢笑 提交于 2020-01-03 18:58:09

问题


I know this question have been asked several times, but none of the solutions I saw solved my problem.

I have been trying to use the serial library from Sublime Text 2 in my mac.

import serial

Everytime I call this library, I get this message:

  Traceback (most recent call last):
    File "/Users/andreapatri/Desktop/test.py", line 1, in <module>
      import serial
  ImportError: No module named serial
  [Finished in 0.0s with exit code 1] 

I already installed python 3

brew install python3

and pyserial

sudo pip install pyserial

I am new using mac. Can you please tell me how to fix the error?


回答1:


I solved this issue with this:

sudo easy_install pyserial



回答2:


This commnad solved my problem on ubuntu:

apt install python3-serial



回答3:


Using python pip:

pip install pyserial



回答4:


try to use pip3 instead of pip

pip3[.X] install pyserial

.X is your python3 version




回答5:


Use python3 for running your script. If you try to use python, you will get this error message.

python3 <scriptname>.py


来源:https://stackoverflow.com/questions/33086281/pyserial-importerror-no-module-named-serial

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!