Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 677
Andrea Diaz Avatar asked Oct 12 '15 16:10

Andrea Diaz


People also ask

Is Pyserial the same as serial?

PySerial is a library which provides support for serial connections ("RS-232") over a variety of different devices: old-style serial ports, Bluetooth dongles, infra-red ports, and so on. It also supports remote serial ports via RFC 2217 (since V2. 5).

How do I know if Pyserial is installed?

To check that it is installed, start Pyzo and at the command prompt type in: import serial If it just gives you another >>> prompt, all is good. Checking that it is really working.


3 Answers

I solved this issue with this:

sudo easy_install pyserial
like image 57
Andrea Diaz Avatar answered Oct 13 '22 20:10

Andrea Diaz


This command solved my problem on ubuntu:

sudo apt install python3-serial
like image 37
Masoud Avatar answered Oct 13 '22 21:10

Masoud


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

python3 <scriptname>.py
like image 2
Ivar Simensen Avatar answered Oct 13 '22 22:10

Ivar Simensen