我最近遇到了一个博客(http://stronginference.com/scipysuperpack/),涉及如何安装Sklearn。我成功安装了它,它存储在路径上:/USR/local/lib/python2.7/site-packages/sklearn
然后,我去了我的日食的属性;在口译员派森(Python)下,并为pythonpath添加了道路。我可以导入Sklearn,但是当我运行此简单的代码以测试所有内容时:
from sklearn import datasets
iris = datasets.load_iris()
digits = datasets.load_digits()
print digits.data
它引发了以下错误:
Traceback (most recent call last):
File "/Users/licheng/Documents/workspaceII/SkLearnTutorial/Src/my_first_scilearn.py", line 6, in <module>
from sklearn import datasets
File "/usr/local/lib/python2.7/site-packages/sklearn/datasets/__init__.py", line 7, in <module>
from .base import load_diabetes
File "/usr/local/lib/python2.7/site-packages/sklearn/datasets/base.py", line 24, in <module>
from ..utils import check_random_state
File "/usr/local/lib/python2.7/site-packages/sklearn/utils/__init__.py", line 10, in <module>
from .murmurhash import murmurhash3_32
File "numpy.pxd", line 155, in init sklearn.utils.murmurhash (/private/var/folders/fv/vhs3w0zn2q961_gyp8f2z_rw0000gn/T/pip-EVsI8B-build/sklearn/utils/murmurhash.c:5029)
ValueError: numpy.dtype has the wrong size, try recompiling
对可能出了什么帮助?我已经使用了几个小时了。
谢谢
尝试卸载numpy,scipy和scikit-learn。然后重新安装那些软件包。
如果您使用的是Windows,那么Christoph Gohlke提供了这些包裹的二进制文件,这很方便。只需下载它们,然后使用PIP安装即可。
Python扩展包的非官方Windows Binaries