Python导入序列,没有名为序列错误的模块

时间:2019-04-26 09:00:27

标签: python pyserial

串行和串行应该安装,但是出现错误no module named serial

jess@DESKTOP-4DGO4EU /cygdrive/c/fyptrial/fypcnn
$ python -m "import serial"
C:\Users\jess\AppData\Local\Programs\Python\Python36\python.exe: No module named import serial

jess@DESKTOP-4DGO4EU /cygdrive/c/fyptrial/fypcnn
$ python -m pip install serial
Requirement already satisfied: serial in c:\users\jess\appdata\local\programs\python\python36\lib\site-packages (0.0.97)
Requirement already satisfied: future>=0.17.1 in c:\users\jess\appdata\local\programs\python\python36\lib\site-packages (from serial) (0.17.1)
Requirement already satisfied: iso8601>=0.1.12 in c:\users\jess\appdata\local\programs\python\python36\lib\site-packages (from serial) (0.1.12)
Requirement already satisfied: pyyaml>=3.13 in c:\users\jess\appdata\local\programs\python\python36\lib\site-packages (from serial) (5.1)

jess@DESKTOP-4DGO4EU /cygdrive/c/fyptrial/fypcnn
$ python -m pip install pyserial
Requirement already satisfied: pyserial in c:\users\jess\appdata\local\programs\python\python36\lib\site-packages (3.4)

2 个答案:

答案 0 :(得分:0)

-m表示模块名称,请参见https://docs.python.org/3/using/cmdline.html

要运行命令,您必须使用-c,因此在您的情况下:

python -c "import serial"

答案 1 :(得分:0)

好像您没有使用python版本的pip版本。 运行python -V 并显示Python 3 尝试pip3 install serial