Andrea Diaz
Andrea Diaz

Reputation: 1188

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?

Upvotes: 12

Views: 51207

Answers (8)

Fernando V
Fernando V

Reputation: 33

Try in anaconda command prompt as:

conda install -c anaconda pyserial

Make sure your relevant serial port is not already used by another program or process that has exclusive access to serial communication.

I hope this helps.😊

Upvotes: 0

Masoud
Masoud

Reputation: 454

This command solved my problem on ubuntu:

sudo apt install python3-serial

Upvotes: 10

tim-montague
tim-montague

Reputation: 17372

Python 2

sudo apt-get install python-serial

Python 3

sudo apt-get install python3-serial

Upvotes: 0

sol0mka
sol0mka

Reputation: 1786

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

Upvotes: 3

Ivar Simensen
Ivar Simensen

Reputation: 193

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

python3 <scriptname>.py

Upvotes: 2

Alex Zh
Alex Zh

Reputation: 11

try to use pip3 instead of pip

pip3[.X] install pyserial

.X is your python3 version

Upvotes: 0

Using python pip:

pip install pyserial

Upvotes: 1

Andrea Diaz
Andrea Diaz

Reputation: 1188

I solved this issue with this:

sudo easy_install pyserial

Upvotes: 11

Related Questions