pydev 中未解决的导入
我是 Python 的首次用户,我在 Windows XP 上安装了 Eclipse (Helios) 并安装了 Pydev,一切都很好,除了当我遵循 Python 的 GAE 教程
我在 run_wsgi_app 和 webapp 上收到未解决的导入错误 从 google.appengine.ext 导入 webapp from google.appengine.ext.webapp.util import run_wsgi_app
代码运行良好。 我寻找了答案并添加了
F:\Program Files\Google\google_appengine\google\appengine\ext
和
F:\Program Files\Google\google_appengine\google\appengine\ext\ webapp
通过 Eclipse Python Interpreter 接口确保我的 PYTHONPATH 。 我已经删除并重新添加了解释器,按“应用”,重新启动 Eclipse,但一切都无济于事。
我发布此内容是因为我确信许多使用 GAE + Python + Eclipse + Pydev 的新用户都会遇到同样的问题。
问候, 克里斯
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
将包父目录(带有 init.py 文件的第一个目录)添加
到 Eclipse 中“外部库”选项卡下的 PYTHONPATH。
还要注意 PyDev 中不尊重/理解 Python 命名空间(而不是包)的错误。有关详细信息,请参阅:
http:// sourceforge.net/tracker/index.php?func=detail&aid=3284882&group_id=85796&atid=577329
Add the package parent directory (the first directory with a init.py file)
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
一般来说,将包的父目录添加到 PYTHONPATH,而不是模块子目录:
In general, add the package's parent directory to PYTHONPATH, not the module subdirectories:
将 ${GOOGLE_APP_ENGINE}/lib/webapp2-2.5.2 添加到“外部库”对我有用。
App Engine SDK 版本:1.8.2
Python版本:2.7
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