Scikit learn 导入错误:无法导入名称';tfidvectorier';水蟒

Scikit learn 导入错误:无法导入名称';tfidvectorier';水蟒,scikit-learn,anaconda,Scikit Learn,Anaconda,无法从sklearn.naive\u bayes和sklearn.pipeline分别导入multinomialNB和make\u pipeline,附加了屏幕截图。我正在使用python3。上次我从“”卸载并安装了anaconda 我也从不同的来源安装和卸载 我也尝试过单独安装软件包。sklearn、scipy或其他软件包已安装并升级,但这段代码一次又一次地出现相同的错误 我在互联网和stackoverflow上尝试了所有可能的解决方案 #importing necessary packag

无法从
sklearn.naive\u bayes
sklearn.pipeline
分别导入
multinomialNB
make\u pipeline
,附加了屏幕截图。我正在使用python3。上次我从“”卸载并安装了anaconda

我也从不同的来源安装和卸载

我也尝试过单独安装软件包。sklearn、scipy或其他软件包已安装并升级,但这段代码一次又一次地出现相同的错误

我在互联网和stackoverflow上尝试了所有可能的解决方案

#importing necessary packages
from sklearn.feature_extraction.text import TfidVectorizer
from sklearn.naive_bayes import multinomialNB
from sklearn.pipeline import make_pipeline

#creating a model based on multinomial naive-bayes
model = make_pipeline(TfidVectorizer(), multinomialNB())

#training the model with train data
model.fit(train.data, train.target)

#creating labels for test data
labels = model.predict(test.data)

您的导入中有一些拼写错误。此外,下次出现错误时,请包括错误消息

from sklearn.feature_extraction.text import TfidfVectorizer # notice the spelling with the f before Vectorizer
from sklearn.naive_bayes import MultinomialNB # notice the Caps on the M
from sklearn.pipeline import make_pipeline
编辑:还有,如果你将来想从SO那里得到答案,这会让你的生活更轻松


欢迎来到SO

导入内容中有一些拼写错误。此外,下次出现错误时,请包括错误消息

from sklearn.feature_extraction.text import TfidfVectorizer # notice the spelling with the f before Vectorizer
from sklearn.naive_bayes import MultinomialNB # notice the Caps on the M
from sklearn.pipeline import make_pipeline
编辑:还有,如果你将来想从SO那里得到答案,这会让你的生活更轻松


欢迎来到SO

非常感谢伊凡:)非常感谢伊凡:)