I am just starting with Python and am having a hard time getting the SERIAL library so that I can interact with a serial port. I went to git hub and downloaded a pyserial-3.5.tar.gz and thought I was able to unzip it all but I do not find SERIAL or serial.py so that I can use
import serial in my python program. This is the statement that all the examples seem to start their code with but don’t I need serial on my computer in order to use this statement? Which also leads to the question of where my python programs should be (I have a folder called PYTHON) and where the library files should be.
My apologies for such simplistic questions, thanks for any help on this.
Install pyserial using ‘pip’ on the command line.
If you’re using Windows, open a “Command Prompt” window and type:
py -m pip install pyserial
Matthew, it seems to have downloaded and installed pyserial. Now, where has it been installed? and will a python program know where it is or should I move it?
I have seen references to ‘pip’. Is that some kind of python installer?
Yes, I am on win10.
Thank you for this help, it is truly appreciated.
pip is the tool that downloads and installs Python packages into Python’s “site-packages” folder. By default it downloads them from PyPI (Python Package Index), which is the go-to place for Python packages.
You should now be able to import the
serial module in Python.
On Windows it’s recommended that you use the Python Launcher
py and install modules using Python’s “pip” module, as I posted above.