简体   繁体   中英

ImportError: cannot import name __check_build while importing TfidfVectorizer from sklearn

I am using Python 2.7.10 and have installed scikit-0.15.2 using pip and i already have "numpy-1.1.10" and "scipy-0.16.0" installed and it works fine but when i try to import TfidfVectorizer from sklearn to construct a term document matrix with tf-idf values

from sklearn.feature_extraction.text import TfidfVectorizer

i get an error:

Traceback (most recent call last):
  File "<pyshell#1>", line 1, in <module>
    import sklearn
  File "C:\Python27\lib\site-packages\sklearn\__init__.py", line 37, in <module>
    from . import __check_build
ImportError: cannot import name __check_build

I have already gone through the earlier post and tried the solutions but it didn't work.

对于Windows用户,请尝试从http://www.lfd.uci.edu/~gohlke/pythonlibs/#scikit-learn安装numpy + mkl软件包,并在成功安装后重新启动python

Had the same problem. installing scipy solved the problem for me. Try...

#sudo pip install scipy

What does it say if you fire up a python prompt and type

import scipy

also there might be some pointers in this thread ImportError in importing from sklearn: cannot import name check_build

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM