scikit-learn: ValueError: numpy.dtype has the wrong size

今天在使用scikit-learn的时候出现了下面的异常:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/sklearn/__init__.py", line 57, in <module>
from .base import clone
File "/Library/Python/2.7/site-packages/sklearn/base.py", line 11, in <module>
from .utils.fixes import signature
File "/Library/Python/2.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 (sklearn/utils/murmurhash.c:5029)
ValueError: numpy.dtype has the wrong size, try recompiling

经过一番搜索,原因是因为我安装scikit-learn的方式不正确,也就是不应该使用pip install scikit-learn在mac上安装,于是我通过源码安装的方式:

git clone https://github.com/scikit-learn/scikit-learn
sudo pip install cpython
make
sudo python setup.py install

完美解决。

本文版权归作者所有,禁止一切形式的转载,复制等操作
赞赏

微信赞赏支付宝赞赏

发表评论

电子邮件地址不会被公开。 必填项已用*标注