'pyserial, ImportError: No module named serial

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?



Solution 1:[1]

I solved this issue with this:

sudo easy_install pyserial

Solution 2:[2]

This commnad solved my problem on ubuntu:

apt install python3-serial

Solution 3:[3]

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

python3 <scriptname>.py

Solution 4:[4]

sudo python3 -m pip install pyserial did the trick for me on Mac OSx Catalina 10.15.6.

Solution 5:[5]

Using python pip:

pip install pyserial

Solution 6:[6]

try to use pip3 instead of pip

pip3[.X] install pyserial

.X is your python3 version

Solution 7:[7]

Python 2

sudo apt-get install python-serial

Python 3

sudo apt-get install python3-serial

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Andrea Diaz
Solution 2 Masoud
Solution 3 Ivar Simensen
Solution 4 sol0mka
Solution 5 Jonathan Carter Hebert
Solution 6 Alex Zh
Solution 7 tim-montague