sklearn ImportError:没有名为_check_build的模块 - python

我正在尝试导入sklearn,但是当我尝试导入时,会收到以下消息:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-2-8fd979e02004> in <module>()
----> 1 import sklearn

C:\Users\Alpine\AppData\Local\Enthought\Canopy\User\sklearn\__init__.py in <module>()
     29     # process, as it may not be compiled yet
     30 else:
---> 31     from . import __check_build
     32     from .base import clone
     33 

C:\Users\Alpine\AppData\Local\Enthought\Canopy\User\sklearn\__check_build\__init__.py in <module>()
     44     from ._check_build import check_build
     45 except ImportError as e:
---> 46     raise_build_error(e)

C:\Users\Alpine\AppData\Local\Enthought\Canopy\User\sklearn\__check_build\__init__.py in raise_build_error(e)
     39 to build the package before using it: run `python setup.py install` or
     40 `make` in the source directory.
---> 41 %s""" % (e, local_dir, ''.join(dir_content).strip(), msg))
     42 
     43 try:

ImportError: No module named _check_build
___________________________________________________________________________
Contents of C:\Users\Alpine\AppData\Local\Enthought\Canopy\User\sklearn\__check_build:
setup.py                  setup.pyc                 _check_build.c
_check_build.pyx          __init__.py               __init__.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.

ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line string', (1, 2))

我相当确定scikit学习has been correctly built,因为我成功运行了python setup.py install而没有任何事件。但是我确实尝试运行python setup.py bdist_wininst -b doc/logos/scikit-learn-logo.bmp,尽管在​​error: cannot copy tree 'build\scripts.win-amd64-2.7': not a directory中被中断了。

可能有人对如何解决此问题有想法吗?

参考方案

好的,以下是我的工作:)

sudo make
sudo python setup.py install

最后,测试安装是否正常:

nosetests --exe sklearn

ImportError:没有名为“ ldap”的模块Python 3.5 - python

我正在运行Python 3.5(在Windows上),并且已经从https://pypi.python.org/pypi/python-ldap/安装了python-ldap我也尝试使用ldap3,但我一直收到错误消息"ImportError: No module named 'ldap'我环顾四周,看到有人说3.5没有pyth…

sklearn KMeans中的KMeans.cluster_centers_的值 - python

在进行K表示适合具有3个聚类的某些向量时,我能够获得输入数据的标签。KMeans.cluster_centers_返回中心的坐标,因此不应该有对应的矢量吗?如何找到这些聚类的质心处的值? 参考方案 closest, _ = pairwise_distances_argmin_min(KMeans.cluster_centers_, X)数组closest将包…

在Python中使用matplotlib转换数组列表以进行绘图 - python

我正在尝试使用sklearn软件包生成滚动回归,然后使用matplotlib将其绘制出来。我已经能够产生滚动回归系数,但是附加输出会导致我很难绘制3D列表。下面的代码给出以下错误:  ValueError:x和y不能大于2-D,但形状为(130,)  和(130,1,5)rCoeff = [] lm = sk_l.LinearRegression() for…

Python GPU资源利用 - python

我有一个Python脚本在某些深度学习模型上运行推理。有什么办法可以找出GPU资源的利用率水平?例如,使用着色器,float16乘法器等。我似乎在网上找不到太多有关这些GPU资源的文档。谢谢! 参考方案 您可以尝试在像Renderdoc这样的GPU分析器中运行pyxthon应用程序。它将分析您的跑步情况。您将能够获得有关已使用资源,已用缓冲区,不同渲染状态上…

Python:图像处理可产生皱纹纸效果 - python

也许很难描述我的问题。我正在寻找Python中的算法,以在带有某些文本的白色图像上创建皱纹纸效果。我的第一个尝试是在带有文字的图像上添加一些真实的皱纹纸图像(具有透明度)。看起来不错,但副作用是文本没有真正起皱。所以我正在寻找更好的解决方案,有什么想法吗?谢谢 参考方案 除了使用透明性之外,假设您有两张相同尺寸的图像,一张在皱纹纸上明亮,一张在白色背景上有深…