Python导入串口,没有名为串口错误的模块

问题描述 投票:0回答:1

应该安装pyserial和serial,但是有一个错误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)
python pyserial
1个回答
0
投票

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

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

python -c "import serial"

© www.soinside.com 2019 - 2024. All rights reserved.