首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >ValueError:通过导入分解,numpy.dtype有错误的大小

ValueError:通过导入分解,numpy.dtype有错误的大小
EN

Stack Overflow用户
提问于 2014-08-09 01:29:15
回答 1查看 7K关注 0票数 2

我正在尝试使用sclearn.decomposition,但我得到了以下错误:

代码语言:javascript
复制
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,我手动删除了它们,但是现在我得到了以下运行时错误:

代码语言:javascript
复制
/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
EN

回答 1

Stack Overflow用户

发布于 2014-08-09 16:46:11

二进制文件似乎有问题。我在熊猫身上也犯了同样的错误,我通过卸载numpy和熊猫来修复它,然后再安装它。

代码语言:javascript
复制
pip uninstall numpy
pip uninstall pandas
pip install pandas==0.13.1

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

似乎你的“矮胖”和“摇头丸”的版本也很古老。试着更新他们。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/25214391

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档