Easy installation using pip.
pip install scikit-learn
Installation is complete. However, when I actually try to import it, the following error is output.
> import sklearn
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
I tried to solve it by referring to here, but it didn't work. It seems that the version of numpy does not match, so I checked the import path with the code below, deleted the related directory, installed numpy again, and it was able to import successfully.
import numpy
print numpy.__file__# Show the path of the file to import
Addition </ b> A similar event was reported in What to do when pip installed packages cannot be imported. After all, it seems that the cause is that the path installed by pip and the path that python goes to see when importing are different.
Recommended Posts