【发布时间】:2012-03-01 01:12:46
【问题描述】:
当我运行以下地狱世界程序(使用 GAE 启动器)时,它可以工作:
import webapp2
class MainPage(webapp2.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = 'text/plain'
self.response.out.write('Hello, webapp World!')
app = webapp2.WSGIApplication([('/', MainPage)],
debug=True)
但是,如果我去终端,我无法导入 webapp2:
C:\Users\Robert>python
Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> import webapp2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named webapp2
>>>
另外,我的 IDE 没有为 webapp2 对象提供自动完成功能。
看到 GAE 启动器使用与我在终端中使用的相同 python 版本,我对导入必须如何在 GAE 启动器中工作感到困惑。
【问题讨论】:
标签: python google-app-engine import