我正在尝试在 web2py 中使用 NLTK。我能够在 Python 命令行和 python 脚本中运行 NLTK,但出现导入错误:
<type 'exceptions.ImportError'> Cannot import module 'applications.DeepThought.modules.nltk'
我已将代码剥离为空,这是令人反感的代码:
# -*- coding: utf-8 -*-
import time
import nltk
def task_waiter(a):
time.sleep(a)
return dict()
def task_add(a,b):
return a+b
def b(a):
return dict()
def d(a):
return dict()
from gluon.scheduler import Scheduler
scheduler = Scheduler(DTtaskDb)
我什至在获取 NLTK 语料库时都没有遇到问题,但我想这是一个问题,当我进行搜索时,没有其他人在简单地导入 NLTK 时遇到问题。
这是我的版本信息:web2py™ Version 2.14.3-stable+timestamp.2016.03.26.23.02.02 Python Python 2.7.3: /Volumes/Macintosh HD 2/Web2Py/web2py.app/Contents/MacOS/python(前缀:/卷/Macintosh HD 2/Web2Py/web2py.app/Contents/Resources)