How do I handle an UnresolvedImport Eclipse (Python)

后端 未结 8 2341
悲&欢浪女
悲&欢浪女 2021-02-20 04:41

When I write import MySQLdb in Eclipse using the PyDev plugin, I get an unresolved import. However, the program runs without error. I can add an annotation to get

8条回答
  •  终归单人心
    2021-02-20 05:20

    I once had a similar problem on Windows (never encountered this on Linux though) and I discovered that I had to include the .egg directory of my library to my PYTHONPATH.

    For example my PYTHONPATH (Pydev/Interpreter - Python/Libraries) included:

    C:\Python26\Lib\site-packages
    

    and I had to add:

    C:\Python26\Lib\site-packages\jinja2-2.2.1-py2.6.egg
    

    to use jinja.

提交回复
热议问题