Unresolved import in pydev

↘锁芯ラ 提交于 2019-12-24 09:42:10

问题


I am a first time user of Python, I have Eclipse (Helios) on Windows XP and Pydev installed and all is well except that when I am following the GAE tutorial for Python

I get the unresolved import error on run_wsgi_app and webapp from from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app

The code runs fine. I have looked for an answer and added

F:\Program Files\Google\google_appengine\google\appengine\ext and

F:\Program Files\Google\google_appengine\google\appengine\ext\webapp

to be sure to my PYTHONPATH via the Eclipse Python Interpreter interface. I have removed and re-added the interpreter, pressed Apply, restarted Eclipse but all to no avail.

I am posting this as I am sure many new users with GAE + Python + Eclipse + Pydev would have the same problem.

Regards, Chris


回答1:


Add the package parent directory (the first directory with a init.py file)

F:\Program Files\Google\google_appengine

to the PYTHONPATH in Eclipse under the 'External Libraries' tab.

Also beware of a bug in PyDev that does not respect/understand Python namespaces (as opposed to packages). For more info see:

http://sourceforge.net/tracker/index.php?func=detail&aid=3284882&group_id=85796&atid=577329




回答2:


In general, add the package's parent directory to PYTHONPATH, not the module subdirectories:

F:\Program Files\Google\google_appengine



回答3:


adding ${GOOGLE_APP_ENGINE}/lib/webapp2-2.5.2 to the "External Libraries" worked for me. App Engine SDK ver:1.8.2 Python version: 2.7



来源:https://stackoverflow.com/questions/5394887/unresolved-import-in-pydev

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