How do I handle an UnresolvedImport Eclipse (Python)

后端 未结 8 2414
悲&欢浪女
悲&欢浪女 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:21

    Fixed this by doing two things:

    1) Added MySQLdb egg to the PYTHONPATH under Window->Preferences->Preferences->PyDev->Python Interpreter.

    C:\Python26\Lib\site-packages\MySQL_python-1.2.3c1-py2.6-win32.egg
    

    2) Close and re-open the .py file that had the red x.

提交回复
热议问题