Pydev say, “Unresolved import” error

前端 未结 11 1426
梦谈多话
梦谈多话 2020-12-10 17:42

hm.. Sometime, PyDev say \"Unresolved import error\". In my environment

Python2.6.6 Eclipse3.7 PyDev2.2.2

Errors are.

         


        
相关标签:
11条回答
  • 2020-12-10 18:13

    You get an unresolved import if the required module cannot be found. Modules are searched for in the current working directory and the directories listed in sys.path. Your python cannot find the modules pycassa and tweepy it appears.

    Might want to check this: http://klaith.wordpress.com/2009/06/12/pydev-unresolved-import-errors/

    0 讨论(0)
  • 2020-12-10 18:16

    Add site-packages path in environmental variables.

    Right click on

    computer -> properties -> advanced system settings -> Environmental variables

    .

    After that is done, remove the python interpreter and add it again in eclipse. right click project name in

    eclipse --> properties --> python interpreter

    .

    Hope it works.

    0 讨论(0)
  • 2020-12-10 18:22

    Is pycassa found as a symlink within a directory on your PYTHONPATH? Pydev apparently has a bug where its code analysis cannot follow symlinks (and hence will not see your libraries). The python interpreter can though of course.

    0 讨论(0)
  • 2020-12-10 18:22

    I was having a similar problem with the dbfpy module.

    1. I had downloaded the tar archive and installed the source files in /usr/lib/python2.7/dist-packages

    2. With this I was able to import the packages in IDLE and even run the code in Eclipse. However the pydev import was still showing as an error with the message "unresolved import"

    3. As suggested by Fabio, I checked the PyDev documentation for forced-builtins. Just adding the name of the package ("dbfpy" in my case to the Forced Builtit tab of Python Interpretr in Eclipse) solved the issue.

    0 讨论(0)
  • 2020-12-10 18:22

    Adding the corresponding package folder ending with '.egg-info' to PyDev > Interpreter - Python - library will resolve the problem.

    In Linux, it is usually under /usr/local/lib/pythonX.X/dist-packages

    0 讨论(0)
  • 2020-12-10 18:23

    Probably your PYTHONPATH is not set properly (or if those are libraries in the interpreter, maybe you added them after configuring it).

    See: http://pydev.org/manual_101_interpreter.html for references (note the part on forced builtins there as it might be your case).

    0 讨论(0)
提交回复
热议问题