Importing using pydev and .pth files

荒凉一梦 提交于 2019-12-10 23:15:44

问题


related to: Unresolved Import Issues with PyDev and Eclipse

Recently I moved my django package to django_trunk so I can have a development version elsewhere. I have no issue importing django, runserver, or any of that.

My issue (annoyance?) is that all of the imports are coming up as underscored red indicating an error.

Pydev clearly knows of the imports, but for whatever reason it still imports as red.

I've noticed this with a few other packages, which use a .pth file instead of a direct import. In the past I've just ignored the red, but with django it's half my screen and I'm loosing critical information.

To demonstrate:

import django #note that django is underscored as red
import sys

print django
print sys.path

module 'django' from 'C:\Python27\Lib\site-packages\django_trunk\django__init__.pyc' [...,'C:\Python27\Lib\site-packages\django_trunk', ...]


回答1:


Try reconfiguring the Interpreter by going to Window -> Preferences -> PyDev -> Interpreter-Python and removing and adding the Python interpreters again.



来源:https://stackoverflow.com/questions/9196595/importing-using-pydev-and-pth-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!