Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 install pyserial
#1
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'
Quote
#2
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.
Feel like you're not getting the answers you want? Checkout the help/rules for things like what to include/not include in a post, how to use code tags, how to ask smart questions, and more.

Pro-tip - there's an inverse correlation between the number of lines of code posted and my enthusiasm for helping with a question :)
Quote
#3
(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.
Quote
#4
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:\>
Quote

Top Page

Forum Jump:


Users browsing this thread: 1 Guest(s)