您好我已经安装了Scikit-learn但是当我尝试导入sklearn模块时我不断收到错误消息。它显示以下消息。谁都知道发生了什么?
import sklearn
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "sklearn/__init__.py", line 31, in <module>
from . import __check_build
File "sklearn/__check_build/__init__.py", line 46, in <module>
raise_build_error(e)
File "sklearn/__check_build/__init__.py", line 41, in raise_build_error
%s""" % (e, local_dir, ''.join(dir_content).strip(), msg))
ImportError: No module named _check_build
___________________________________________________________________________
Contents of sklearn/__check_build:
__init__.py __init__.pyc _check_build.c
_check_build.pyx setup.py setup.pyc
___________________________________________________________________________
It seems that scikit-learn has not been built correctly.
If you have installed scikit-learn from source, please do not forget
to build the package before using it: run `python setup.py install` or
`make` in the source directory.
If you have used an installer, please check that it is suited for your
Python version, your operating system and your platform.
答案 0 :(得分:2)
正如您在错误中看到的那样:ImportError: No module named _check_build
在该目录中它有.c
个文件且从未编译过。
如果您选中this link,则会看到scikit-learn
的许多部分都是用C语言编写的。
因此,要安装此类软件包,您需要在系统中安装python-dev
软件包。
python-dev
包会安装许多C标头,例如python.h
。
在您的系统中安装python-dev
包,然后再次删除并安装scikit-learn
包。