NLTK在MAC OSX中不起作用

时间:2016-06-17 11:41:53

标签: scikit-learn nltk

from nltk.tokenize import word_tokenize
k=[]
example=['Mary had a little lamb' ,  'Jack went up the hill' , 'Jill followed suit' ,'i woke up suddenly','it was a really bad dream...']
for i in example:
    k.append(word_tokenize(i))

我试图编译这段代码,但它没有编译,并且给出的错误如下:

File "<stdin>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/nltk/__init__.py", line 128, in <module>
    from nltk.chunk import *
  File "/Library/Python/2.7/site-packages/nltk/chunk/__init__.py", line 157, in <module>
    from nltk.chunk.api import ChunkParserI
  File "/Library/Python/2.7/site-packages/nltk/chunk/api.py", line 13, in <module>
    from nltk.parse import ParserI
  File "/Library/Python/2.7/site-packages/nltk/parse/__init__.py", line 79, in <module>
    from nltk.parse.transitionparser import TransitionParser
  File "/Library/Python/2.7/site-packages/nltk/parse/transitionparser.py", line 21, in <module>
    from sklearn.datasets import load_svmlight_file
  File "/Users/sudhir/Library/Python/2.7/lib/python/site-packages/sklearn/__init__.py", line 57, in <module>
    from .base import clone
  File "/Users/sudhir/Library/Python/2.7/lib/python/site-packages/sklearn/base.py", line 11, in <module>
    from .utils.fixes import signature
  File "/Users/sudhir/Library/Python/2.7/lib/python/site-packages/sklearn/utils/__init__.py", line 10, in <module>
    from .murmurhash import murmurhash3_32
  File "numpy.pxd", line 155, in init sklearn.utils.murmurhash (sklearn/utils/murmurhash.c:5029)
ValueError: numpy.dtype has the wrong size, try recompiling

0 个答案:

没有答案