【发布时间】:2013-05-17 21:18:54
【问题描述】:
我正在尝试在 Google App Engine 中导入 NLTK 库,但出现错误,我创建了另一个模块“testx.py”,该模块正常工作,但我不知道为什么 NLTK 不起作用。
我的代码 nltk_test.py
导入 webapp2 导入路径转换器 导入 testx 导入 nltk 类 MainPage(webapp2.RequestHandler): 定义获取(自我): #self.response.headers['Content-Type'] = 'text/plain' self.response.write("测试") 类 nltkTestPage(webapp2.RequestHandler): 定义获取(自我): text = nltk.word_tokenize("现在是完全不同的东西") self.response.write(testx.test("Hellooooo")) 应用程序 = webapp2.WSGIApplication([ ('/', MainPage), ('/nltk', nltkTestPage), ],调试=真)testx.py 代码
定义测试(txt): 返回长度(txt)path_changer.py 代码
导入操作系统 导入系统 sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'nltk')) sys.path.insert(1, os.path.join(os.path.dirname(__file__), 'new'))app.yaml
应用程序:nltkforappengine 版本:0-1 运行时:python27 api_version: 1 线程安全:真 处理程序: - 网址:/.* 脚本:nltk_test.application - 网址:/nltk.* 脚本:nltk_test.application 图书馆: - 名称:numpy 版本:“1.6.1”这段代码运行良好当我注释import nltk和nltk相关代码时,我认为NLTK没有被导入,请帮我解决这个问题,谢谢
【问题讨论】:
-
HTTP 错误 500(内部服务器错误):服务器尝试完成请求时遇到了意外情况。
标签: google-app-engine python-2.7 nltk