0

I don't know what when wrong but somehow I can't use the serial module from pyserial.

(venv) pi@raspberrypi:~/workspace/test $ python
Python 3.7.0 (default, Apr 28 2020, 16:06:28)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import serial
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'serial'
>>>

but according to pip list it is installed

(venv) pi@raspberrypi:~/workspace/test $ pip3 list
Package           Version
----------------- -----------
...
pyserial          3.4
...

I installed python3.7 and created a python alias for it, in case that matters. Another funny thing is that it seems like I cannot uninstall it

(venv) pi@raspberrypi:~/workspace/test $ sudo pip3 uninstall pyserial
Not uninstalling pyserial at /usr/lib/python3/dist-packages, outside environment /usr
Can't uninstall 'pyserial'. No files were found to uninstall.

Someone has an idea how to solve that?

0

You need to install Python modules for every version of Python you want to use.

The correct way to install pyserial is from the repositories.

sudo apt install python-serial # Python 2
sudo apt install python3-serial # Python 3

If you are using pip (why?) try using pip3 to install pyserial.

| improve this answer | |
  • I solved it using pip3.7 instead of just pip3 – po.pe Apr 28 at 16:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.