这是我正在使用的脚本
# this script starts in powershell so I change the directory to Python27
os.chdir("/Python27/"
#print cwd as a check
print os.getcwd()
import nltk
text = nltk.work_tokenize("thanks, Chuck and it's always nice when you get Brian's name corrected, it shows how closely we .....blah blah blah")
#print text as a check
print text
nltk.pos_tag(text)
脚本将打印文本,但紧接着是导入错误
Import Error message is as follows;
Traceback (most recent call last):
File "calls_1.txt", line 15, in <module>
nltk.pos_tag(text)
File "C:\Python27\lib\site-packages\nltk\tag\__init__.py", line 99, in pos_tag
tagger = load(_POS_TAGGER)
File "C:\Python27\lib\site-packages\nltk\data.py"' line 605, in load
resource_val = pickle.load(_oopen(resource_url))
ImportError: No module named numpy.core.multiarray
然而,似乎存在多阵列模块。这是sys.path
>>> for pth in sys.path:
... print pth
...
C:windows\system32\python27.zip
C:\Pthon27\DLLs
C:\Python27\lib
C:\Python27\lib\plat-win
C:\Python27\lib\lib-tk
C:\Python27
C:\Python27\lib\site-packages
>>>
在C:\Python27\lib\site-packages
目录中有以下目录:
nltk
nltk-2.0.4-py2.5.egg-info
numpy
yaml
yaml.pyd
PyYAML-3.10-py2.7.egg-info
README.txt
numpy目录中的有以下目录
core
fft
lib
lnalg
random
在核心目录中有以下pyd文件
_dotblas.pyd
_sort.pyd
multiarray.pyd
scalarmath.pyd
umath.pyd
因此看起来多阵列存在但未找到。
对于如何继续更正脚本的任何建议表示赞赏。