"ImportError: No module named serial" - after installing pyserial
how did you install your serial module? If you want to make sure It will be detected, go into your console
pip install serial
and run your code from the console too
python test.py # make sure your console is in the right folder path
or
find where the module is installed, something like "C:\Python27\Lib\site-packages"
import sys
sys.path.append("C:\Python27\Lib\site-packages") # this is where python stores modules, yours could be different
import serial
Admin
Updated on July 02, 2022Comments
-
Admin almost 2 years
I'm writing a project in python which should eventually running on LinkIt One IoT device.
I've written some test code to check whether I am able to connect between Arduino IDE to python (I am working with Pycharm).
the test code is:
import serial import time arduino = serial.Serial('COM1', 115200, timeout=.1) time.sleep(1) #give the connection a second to settle arduino.write("Hello from Python!") while True: data = arduino.readline() if data: print data.rstrip('\n')
when I am running to code I am getting:
C:\Users\אורי\PycharmProjects\untitled\venv\Scripts\python.exe C:/Users/אורי/PycharmProjects/untitled2/test.py
Traceback (most recent call last): File "C:/Users/����/PycharmProjects/untitled2/test.py", line 1, in import serial ImportError: No module named serial
-
Ekrem Dinçel about 4 yearsIt is
pyserial
on PyPi, notserial
. -
Peko Chan about 4 yearsI haven't really check it, I was moslty focusing on the procedure,"how to do it", so you can do it with any package