Netbeans python Pyserial import not found
-
02-01-2020 - |
Question
I installed "plugged in" Python as a plug in into Netbeans using from here. I was using Eclipse, and even though it was a little wonky, it could at least find Pyserial. Now, when I try to run a project (which worked fine in Eclipse), I get the following error:
Traceback (most recent call last):
File "G:\Prog\PythonCurrent\RadioDB\src\radiodb.py", line 8, in <module>
import serial
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1191, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1161, in _load_backward_compatible
File "c:\Python34\lib\site-packages\pyserial-2.7-py3.4-win32.egg\serial\__init__.py", line 19, in <module>
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1191, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1161, in _load_backward_compatible
File "c:\Python34\lib\site-packages\pyserial-2.7-py3.4-win32.egg\serial\serialwin32.py", line 12, in <module>
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2222, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 2164, in _find_spec
File "<frozen importlib._bootstrap>", line 1940, in find_spec
File "<frozen importlib._bootstrap>", line 1916, in _get_spec
File "<frozen importlib._bootstrap>", line 1897, in _legacy_get_spec
File "<frozen importlib._bootstrap>", line 863, in spec_from_loader
File "<frozen importlib._bootstrap>", line 904, in spec_from_file_location
File "c:\Python34\lib\site-packages\pyserial-2.7-py3.4-win32.egg\serial\win32.py", line 196
MAXDWORD = 4294967295L # Variable c_uint
^
SyntaxError: invalid syntax
I don't understand why. My python34\Lib
directory contains searial
's stuff, and in python34\Lib\site-packages
I have the same folder in addition to pyserial's egg and egg-info files. Do I need to specify where these are in Netbeans or copy some folders to Netbeans?
SOLUTION:
Thanks @Padraic Cunningham
I just like to make sure that the solution is clear for anyone because I have been lost before (like anyone at first).
Sooo, the solution is use pip3 install pyserial to install for python3
...
I like to make cmd doskey macros, so I'll probably do that, but the easiest thing to install something with "pip3" is go to cmd.exe/terminal and then go to python home directory, then cd to scripts
; type pip3.exe install pyserial
or whatever you are installing (you can use pip3.4.exe...
if you have it) and voila... easiest thing in the world if you know about it.
La solution
@PadraicCunningham
use pip3 install pyserial
to install almost major packages.
Autres conseils
Pyserial isn't updated to Python 3 yet, it only works in Python 2. So change your interpreter to Python 2.7.