【发布时间】:2013-07-16 14:06:17
【问题描述】:
我刚刚在我的 python 2.7 上安装了 pandas 和 statsmodels 包 当我尝试“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
【问题讨论】:
-
你是如何安装 pandas 的?
-
你试过重新编译吗?
-
为什么不使用 python(x,y)、enthought 或 winpython 发行版?它们专门为在 windows 下为科学 python 用户消除这些编译和安装问题而设计,并随附您可能想要预编译的大多数包。
-
当 pandas 编译为比您安装的版本更新的 numpy 版本时,会显示此消息。您需要针对已安装的 numpy 版本重新编译 pandas 或更新 numpy。
标签: python numpy installation pandas statsmodels