简体   繁体   中英

Can not import PySerial even though it's installed

I'm trying to import PySerial import serial , but i get a ModuleNotFoundError: No module named 'serial' . I installed PySerial via conda install pyserial and I also tried with pip install pyserial in both cases I get the same error, but if execute conda list or pip list pyserial appears in the list. I'm using VS Code on Windows and unistalled and reinstalled Anconda, VS Code and PySerial serveral times. I checked also, that there is not the serial package.

Can anybody tell me why I can not import serial ?

Edit:

I also tried conda install -c conda-forge pyserial once...

Probably you are not running the python version you think you are.

Find full path of the Python interpreter?

try:

 import sys
 print(sys.executable)

And see if it matches what you expect.

If you don't know what to expect, it's more likely you aren't running the right pip. In that case you could make sure to run the right pip like this:

python -m pip install pyserial

Which pip is with which python?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM