Oscar_Panczenko
Oscar_Panczenko

Reputation: 41

Python ImportError: No module named serial

I have installed Python 2.7.5 on Ubuntu 12.4 on a DELL LATITUDE E4300 64 bit and ran:

sudo pip install pyserial

nevertheless when running:

sudo python main.py 

I receive the following error message:

Traceback (most recent call last):
  File "main.py", line 4, in <module>
    from mySerial import *
  File "/home/oscar/ath10k/tools/sanity_test/src/mySerial.py", line 6, in <module>
    import serial
ImportError: No module named serial

I looked on other posts but none of them helped me to solve this problem. I don't know what else to do I also ran:

sudo -H pip install pyserial

and

sudo pip install pyserial --upgrade

Any help will be greatly appreciated.

Kind regards.

Oscar.

Upvotes: 2

Views: 17036

Answers (3)

BitByte_Bake
BitByte_Bake

Reputation: 969

On my ubuntu 14.4 with python 2.7 as default, I installed pyserial for python3 (which my IDE is using actually) with the help of following command:

 sudo apt-get install python3-serial

Upvotes: 5

Oscar_Panczenko
Oscar_Panczenko

Reputation: 41

I solved this by installing pyserial from source code instead than doing it with pip.

I do not know why it works this way and when using pip it prints error messages.

Upvotes: 0

lunaferie
lunaferie

Reputation: 401

Your script name is exactly like module name, change mySerial.py to something else.

Upvotes: 0

Related Questions