Python ValueError:numpy.dtype的大小不正确,具有导入分解

Python ValueError:numpy.dtype的大小不正确,具有导入分解,python,numpy,scikit-learn,Python,Numpy,Scikit Learn,我正在尝试使用sclearn.decomposition,但出现以下错误: Python 2.7.5 (default, Mar 9 2014, 22:15:05) [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin >>> import sklearn, numpy,scipy >>> sklearn.__version__ '0.15.1' >>> num

我正在尝试使用sclearn.decomposition,但出现以下错误:

Python 2.7.5 (default, Mar  9 2014, 22:15:05) 
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin

>>> import sklearn, numpy,scipy
>>> sklearn.__version__
'0.15.1'
>>> numpy.__version__
'1.6.2'
>>> scipy.__version__
'0.11.0'
>>> 
>>> from sklearn import decomposition
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/sklearn/decomposition/__init__.py", line 7, in <module>
    from .nmf import NMF, ProjectedGradientNMF
  File "/Library/Python/2.7/site-packages/sklearn/decomposition/nmf.py", line 21, in <module>
    from ..utils import atleast2d_or_csr, check_random_state, check_arrays
  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

似乎二进制文件有问题。我在pandas上遇到了同样的错误,我通过卸载numpy和pandas并重新安装来修复它

pip uninstall numpy
pip uninstall pandas
pip install pandas==0.13.1
请注意,安装pandas也会安装它的依赖项,如numpy


您的numpy和scipy版本似乎也很旧。尝试更新它们。

可能类似于。否则,您可以尝试从源代码处安装scikit learn,或使用预制的python环境,如anaconda。正如更新所述,我卸载(一些手动)并使用pip重新安装了所有内容。这些是我安装的最新版本:>>>>导入numpy、scipy、sklearn、pandas>>>>numpy.\uuu版本\uuuuu'1.8.2'>>>scipy.\uuu版本\uuuuuu'0.14.0'>>>sklearn.\uu版本\uuuuuu'0.15.1'>>>pandas.\uuuu版本\uu'0.13.1'仍然是相同的错误。唯一的解决办法是如果我没有完全卸载它们。有办法检查吗?您可以通过键入:import numpy print numpy尝试定位numpy这将为您提供numpy所在的路径。然后,您所需要做的就是删除该包。我希望有帮助
pip uninstall numpy
pip uninstall pandas
pip install pandas==0.13.1