ValueError: numpy.dtype has the wrong size, try recompiling,如何解决?

内容来源于 Stack Overflow,并遵循CC BY-SA 3.0许可协议进行翻译与使用

  • 回答 (2)
  • 关注 (0)
  • 查看 (60)

我刚在我的python2.7上安装了熊猫和状态模型包,当我尝试“import pandas as pd”时,这个错误消息就出来了。有人能帮忙吗?谢谢!!!

numpy.dtype has the wrong size, try recompiling
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\analytics\ext\python27\lib\site-packages\statsmodels-0.5.0-py2.7-win32.egg\statsmodels\formula\__init__.py",
line 4, in <module>
    from formulatools import handle_formula_data
  File "C:\analytics\ext\python27\lib\site-packages\statsmodels-0.5.0-py2.7-win32.egg\statsmodels\formula\formulatools.p
y", line 1, in <module>
    import statsmodels.tools.data as data_util
  File "C:\analytics\ext\python27\lib\site-packages\statsmodels-0.5.0-py2.7-win32.egg\statsmodels\tools\__init__.py", li
ne 1, in <module>
    from tools import add_constant, categorical
  File "C:\analytics\ext\python27\lib\site-packages\statsmodels-0.5.0-py2.7-win32.egg\statsmodels\tools\tools.py", line
14, in <module>
    from pandas import DataFrame
  File "C:\analytics\ext\python27\lib\site-packages\pandas\__init__.py", line 6, in <module>
    from . import hashtable, tslib, lib
  File "numpy.pxd", line 157, in init pandas.tslib (pandas\tslib.c:49133)
ValueError: numpy.dtype has the wrong size, try recompiling
提问于
用户回答回答于

For me (Mac OS X Maverics, Python 2.7)

easy_install --upgrade numpy

这样可以:

pip install pandas
用户回答回答于

在numpy中断中改进或重构ABI向后兼容性。在Numpy 1.4.0中(无意中)发生了这种情况。因此,将numpy更新为1.4.0的用户与所有其他已编译包具有二进制不兼容,这些包是针对以前版本的numpy编译的。这要求所有使用numpy的二进制扩展的包都必须重新编译,才能使用ABI不兼容的版本。

扫码关注云+社区