ValueError: numpy.由于导入分解,Dtype有错误的大小



我试图使用clear .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

我尝试使用pip卸载和安装所有的软件包。不知道还有什么可以尝试的建议吗?

更新:

原来我安装了一个旧版本的numpy/scipy,我手动删除了它们,但现在我得到以下运行时错误:

/Library/Python/2.7/site-packages/scipy/stats/_continuous_distns.py:24: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility
  from . import vonmises_cython
/Library/Python/2.7/site-packages/scipy/stats/_continuous_distns.py:24: RuntimeWarning: numpy.ufunc size changed, may indicate binary incompatibility
  from . import vonmises_cython
/Library/Python/2.7/site-packages/scipy/stats/stats.py:188: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility
  from ._rank import rankdata, tiecorrect
/Library/Python/2.7/site-packages/scipy/stats/stats.py:188: RuntimeWarning: numpy.ufunc size changed, may indicate binary incompatibility
  from ._rank import rankdata, tiecorrect
/Library/Python/2.7/site-packages/scipy/spatial/__init__.py:90: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility
  from .ckdtree import *
/Library/Python/2.7/site-packages/scipy/spatial/__init__.py:90: RuntimeWarning: numpy.ufunc size changed, may indicate binary incompatibility
  from .ckdtree import *
/Library/Python/2.7/site-packages/scipy/spatial/__init__.py:91: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility
  from .qhull import *
/Library/Python/2.7/site-packages/scipy/spatial/__init__.py:91: RuntimeWarning: numpy.ufunc size changed, may indicate binary incompatibility
  from .qhull import *
/Library/Python/2.7/site-packages/scipy/interpolate/interpolate.py:28: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility
  from . import _ppoly
/Library/Python/2.7/site-packages/scipy/interpolate/interpolate.py:28: RuntimeWarning: numpy.ufunc size changed, may indicate binary incompatibility
  from . import _ppoly

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

pip uninstall numpy
pip uninstall pandas
pip install pandas==0.13.1

请注意,安装pandas还会安装它的依赖项,如numpy。

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

相关内容

  • 没有找到相关文章

最新更新