我想在程序中导入nltk以下载语料库。 但是我收到了错误:
Traceback (most recent call last):
File "C:/Users/Android.DESKTOP-S6P9R3V.001/Desktop/ud120-projects-master/blah.py", line 1, in <module>
import nltk
File "C:\Users\Android.DESKTOP-S6P9R3V.001\Anaconda2\lib\nltk\__init__.py", line 128, in <module>
from nltk.chunk import *
File "C:\Users\Android.DESKTOP-S6P9R3V.001\Anaconda2\lib\nltk\chunk\__init__.py", line 157, in <module>
from nltk.chunk.api import ChunkParserI
File "C:\Users\Android.DESKTOP-S6P9R3V.001\Anaconda2\lib\nltk\chunk\api.py", line 15, in <module>
from nltk.chunk.util import ChunkScore
File "C:\Users\Android.DESKTOP-S6P9R3V.001\Anaconda2\lib\nltk\chunk\util.py", line 13, in <module>
from nltk.tag.mapping import map_tag
File "C:\Users\Android.DESKTOP-S6P9R3V.001\Anaconda2\lib\nltk\tag\__init__.py", line 63, in <module>
from nltk.tag.sequential import (SequentialBackoffTagger, ContextTagger,
File "C:\Users\Android.DESKTOP-S6P9R3V.001\Anaconda2\lib\nltk\tag\sequential.py", line 25, in <module>
from nltk.classify import NaiveBayesClassifier
File "C:\Users\Android.DESKTOP-S6P9R3V.001\Anaconda2\lib\nltk\classify\__init__.py", line 93, in <module>
from nltk.classify.scikitlearn import SklearnClassifier
ImportError: No module named scikitlearn
任何帮助将不胜感激。 我使用anaconda下载了nltk,并使用了Windows机器。
答案 0 :(得分:0)
我相信该模块被称为sklearn,交替使用scikit-learn。见https://docs.continuum.io/anaconda/
答案 1 :(得分:0)
我认为你正在使用
import scikit-learn
没有名为scikit-learn的模块。 你应该使用
import sklearn
如果上述方法不起作用,
尝试使用anaconda python 你应该尝试以下
conda install scikit-learn
并添加此项以提高性能 - 如果未安装
conda install numpy