问题
I've installed pytables under windows 7 64 bit and it passes all the tests. Both python from command prompt and IDLE can successfully see the StringCol class, and even the python console in Eclipse can see it.
However, PyDev's autocomplete can't discover the class, and editor keeps displaying an error that says undefined variable: StringCol
Despite the error, the following code runs successfully in eclipse, using PyDev
from tables import *
if __name__ == '__main__':
a = StringCol(34)
print (a)
I've switched workspaces, created projects from scratch, deleted the pyc that contains the class. Nothing seems to help. How do I make pydev recognize the class which is obviously sitting where it is supposed to?
回答1:
Have you configured the "forced builtins" in the interpreter. From the getting-started guide:
Additionally, you may add other libraries that you want to treat as builtins, such as os, wxPython, OpenGL, etc. This is very important, because PyDev works on the java side only with static information, but some modules don't have much information when analyzed statically, so, PyDev creates a shell to get information on those.
来源:https://stackoverflow.com/questions/16668152/pydev-cant-see-class-from-pytables