我正在尝试使用 Mac OS Mojave 在我的 2015 Mac Pro 上安装 NLTK。我用了sudo pip install nltk它下载了安装文件并成功安装。当我进入 python 并输入时nltk.download()我明白了NLTK Downloader---------------------------------------------------------------------------d) Download l) List u) Update c) Config h) Help q) Quit---------------------------------------------------------------------------Downloader>使用“d”后,它下载了一些包和模块。但是,当我尝试运行它时,我无法使用 nltkfrom nltk.tokenize import sent_tokenize, word_tokenizedata = "All work and no play makes jack dull boy. All work and no play makes jack a dull boy."print(sent_tokenize(data))这给了我一个错误说:File "token.py", line 1, in <module>from nltk.tokenize import sent_tokenize, word_tokenizeFile "/Library/Python/2.7/site-packages/nltk/__init__.py", line 129, in <module>from nltk.collocations import *File "/Library/Python/2.7/site-packages/nltk/collocations.py", line 38, in <module>from nltk.util import ngramsFile "/Library/Python/2.7/site-packages/nltk/util.py", line 10, in <module>import inspectFile "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/inspect.py", line 39, in <module>import tokenizeFile "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/tokenize.py", line 31, in <module>from token import *File "/Users/Documents/NLTK/token.py", line 1, in <module>from nltk.tokenize import sent_tokenize, word_tokenizeFile "/Library/Python/2.7/site-packages/nltk/tokenize/__init__.py", line 67, in <module>from nltk.tokenize.mwe import MWETokenizerFile "/Library/Python/2.7/site-packages/nltk/tokenize/mwe.py", line 31, in <module>from nltk.util import TrieImportError: cannot import name Trie请帮忙!
添加回答
举报
0/150
提交
取消