I am using pyserial so I can connect to arduino through a serial port. Unfortunately, python cannot find where I installed pyserial. This is the warning I get when I reinstall pyserial:
WARNING: The scripts pyserial-miniterm.exe and pyserial-ports.exe are installed in 'C:\Users\Downtown\AppData\Roaming\Python\Python311\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
I think this is to do with PATH not having the right location in environment variables, but every time I add
C:\Users\Downtown\AppData\Roaming\Python\Python311\Scripts
to environment variables, under path, after restarting my computer and the IDE I'm using, and reinstalling pyserial I still get the same warning message, and I run into an error on
import serial
I've tried reinstalling python, to no avail; I checked the docs, the import statement I'm using is right; I moved the pyserial package to a different location and set its location in the path; I tried to install the package manually, instead of through pip, the package is meant to be extracted on linux. I don't really understand how environment variables work, but from my research, all I need to do is add the pyserial package location to environment variables under path
This is the command I run to install pyserial:
pip install pyserial --user
This is a screenshot of my environment variables:
this is what I get when I run import sys; print(sys.path)
:
['C:\\Users\\Downtown\\OneDrive\\Desktop\\Projects\\Scripting\\ArduinoSerialPortReader',
'C:\\Users\\Downtown\\OneDrive\\Desktop\\Projects\\Scripting\\ArduinoSerialPortReader',
'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.2800.0_x64__qbz5n2kfra8p0\\python310.zip',
'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.2800.0_x64__qbz5n2kfra8p0\\DLLs',
'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.2800.0_x64__qbz5n2kfra8p0\\lib',
'C:\\Users\\Downtown\\AppData\\Local\\Microsoft\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0',
'C:\\Users\\Downtown\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python310\\site-packages',
'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.2800.0_x64__qbz5n2kfra8p0',
'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.2800.0_x64__qbz5n2kfra8p0\\lib\\site-packages']
Thanks in advance to anyone who tries to help
It turns out I had a problem with my PYTHONPATH, not my PATH, it couldn't find the site-packages of my current python version, as it was trying to use the site-packages of a previous update. To solve the problem, I had to make a PYTHONPATH environment variable reference my current python site-packages, and delete the older python version. Thanks for the amazing help, @Charles Duffy