pyserial, ImportError: No module named serial
Asked Answered
G

8

12

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?

Goodfellowship answered 12/10, 2015 at 16:48 Comment(0)
G
11

I solved this issue with this:

sudo easy_install pyserial
Goodfellowship answered 12/10, 2015 at 18:46 Comment(0)
H
10

This command solved my problem on ubuntu:

sudo apt install python3-serial
Hypotrachelium answered 28/10, 2016 at 4:15 Comment(1)
consider sudo apt ...Susa
O
3

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

Ostend answered 12/9, 2020 at 20:33 Comment(1)
Confirmed big sur 11.2.3Caddaric
D
2

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

python3 <scriptname>.py
Downtrend answered 9/10, 2019 at 8:49 Comment(0)
B
1

Using python pip:

pip install pyserial
Bumblebee answered 28/10, 2017 at 22:12 Comment(0)
M
0

try to use pip3 instead of pip

pip3[.X] install pyserial

.X is your python3 version

Marchpane answered 12/6, 2019 at 18:17 Comment(0)
C
0

Python 2

sudo apt-get install python-serial

Python 3

sudo apt-get install python3-serial
Chopine answered 14/6, 2021 at 2:21 Comment(0)
A
0

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.😊

Ardine answered 11/9, 2023 at 13:47 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.