【发布时间】:2014-06-28 06:32:57
【问题描述】:
您好,我已经安装了 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.
【问题讨论】:
-
你是怎么安装的?你的操作系统是什么?
-
在雪豹 cd、gfortran、numpy 1.8 和 scipy 中安装 xcode 后,在 osx 10.6.8 中运行 setup.py 脚本。
-
我已经通过 apt-get 尝试过,它工作正常。你在系统中安装了
python-dev包吗? -
我不这么认为。我使用的是预安装的 python 版本,但我改为 2.7 版本。 python-dev包是什么?
-
python-dev包将安装许多 C 头文件,例如python.h,许多包已经用 C 编写,python 可以使用它们。