问题
I updated PyDev (Eclipse) yesterday and now it is telling me that None, name and other reserved words/builtin functions are invalid, but the script runs just fine. I have read on this forum that the problem deals with incorrectly importing the built-ins. I have tried changing the interpreter and re-adding it but no luck. Can somebody help me please?
The errors:
Undefined variable main Undefined variable None Undefined variable int Undefined variable eval
I am running eclipse Juno and PyDev 2.7.4. also, I notice that the errors only appear after the PyDev code analysis ends.
回答1:
This happened to me as well, the problem was that eclipse couldn't find python.
My fix:
in Eclipse:
Window > Preferences > PyDev > Interpreter - Python
The settings here were blank. I clicked 'Auto Config', which suggested to me the path to python. I chose it, restarted eclipse, and problem solved.
回答2:
Well, I see nobody has come up with some idea. I found out by myself so I'm posting how I solved it here; maybe it'll help somebody:
The problem was that I had recently changed my local machine's name, but PyDev was still looking for localhost when it tried to connect to the Python Shell. I just updated the files in my operating system containing the hostname, and voila (the automatic wizard did not update all the files for some reason, so I had to do it manually).
来源:https://stackoverflow.com/questions/16696792/eclipse-pydev-is-throwing-false-errors