Python Forum

Full Version: install pyserial
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
hi all,

I able to install Pyserial in CMD but still unable to use it. i not sure where i'm go wrong . hope someone can help and share with me.

import time
import serial
 
ser = serial.Serial('COM6', 115200)
  
while True:
 value = ser.readline()
 print(value)
 time.sleep(0.5)
Error:
ModuleNotFoundError Traceback (most recent call last) <ipython-input-3-c45aee60da5c> in <module>() 1 import time ----> 2 import serial 3 4 ser = serial.Serial('COM6', 115200) 5 ModuleNotFoundError: No module named 'serial'
How did you install it? What OS are you using? Do you have multiple versions of Python installed?

My first guess is that the answer to the last question is yes, and that you installed it for a different version than the one you're trying to use it from.
(Jul-13-2019, 05:18 PM)micseydel Wrote: [ -> ]How did you install it? What OS are you using? Do you have multiple versions of Python installed?

My first guess is that the answer to the last question is yes, and that you installed it for a different version than the one you're trying to use it from.

Hi micseydel,
i using window 10 and my python version is Python 3.6.5. no multiple version python installed.
In cmd:
C:\>python -V
Python 3.7.3

C:\>python -c "import sys; print(sys.executable)"
C:\python37\python.exe

C:\>pip -V
pip 19.1.1 from c:\python37\lib\site-packages\pip (python 3.7)
See that pip -V is pointing to python 3.7.
This men that doing pip install pyserial will only install to python 3.7.
C:\>pip install pyserial
Collecting pyserial
  Downloading https://files.pythonhosted.org/packages........
Installing collected packages: pyserial
Successfully installed pyserial-3.4

# Test that it work
C:\>python
Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 21:26:53) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import serial
>>>
>>> serial.__version__
'3.4'
>>> exit()

C:\>