简体   繁体   中英

Pydev, eclipse and pythonpath problem

I've installed pydev to my eclipse 3.5.2. Everything was working smoothly, create projects, execute, test, autocomplete.

But then I realized that importing modules from /usr/lib/pymodules/python2.6, such as django, causes error "Unresolved import: xxxx". Of course, PYTHONPATH SYSTEM includes the directories I want. What's more, inside package explorer i can c the modules under "System Libs".

I just can't import them :S. Is this a bug? Or I just missing something.

Thanks.

In eclipse you can add django folder in you python path.

Window->Preferences-> PyDev-> Interpreters->Python Interpreter -> Lirararies -> New Folder

And browse till the parent folder of modules you are searching.

If you're using virtualenv you should setup an interpreter using the python build inside.

ie., default python interpreter for th project will be /usr/bin/python

but change it to something like "{project name} python" and point it to your virtual env path. In my case it's ~/.virtualenvs/acme/bin/python

在PyDev中似乎有某种缓存问题……在这种情况下,您可以尝试删除解释器,再次添加它并重新启动Eclipse。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM