Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/329.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 参数值错误:numpy.dtype的大小错误,请尝试重新编译_Python_Numpy_Pandas - Fatal编程技术网

Python 参数值错误:numpy.dtype的大小错误,请尝试重新编译

Python 参数值错误:numpy.dtype的大小错误,请尝试重新编译,python,numpy,pandas,Python,Numpy,Pandas,我重新安装了OSX 10.9.3,安装了pip,然后安装了 pip install pandas pip install numpy 安装熊猫 pip安装numpy 两次安装似乎都非常顺利,运行时没有任何错误(尽管有无数的警告)。当我尝试使用import pandas运行python脚本时,出现以下错误: numpy.dtype has the wrong size, try recompiling Traceback (most recent call last): File "./

我重新安装了OSX 10.9.3,安装了pip,然后安装了

pip install pandas pip install numpy 安装熊猫 pip安装numpy 两次安装似乎都非常顺利,运行时没有任何错误(尽管有无数的警告)。当我尝试使用import pandas运行python脚本时,出现以下错误:

numpy.dtype has the wrong size, try recompiling Traceback (most recent call last): File "./moen.py", line 7, in import pandas File "/Library/Python/2.7/site-packages/pandas/__init__.py", line 6, in from . import hashtable, tslib, lib File "numpy.pxd", line 157, in init pandas.hashtable (pandas/hashtable.c:22331) ValueError: numpy.dtype has the wrong size, try recompiling numpy.dtype的大小错误,请尝试重新编译回溯(最近一次调用last): 文件“/moen.py”,第7行,在导入pandas文件“/Library/Python/2.7/site packages/pandas/_init__.py”中,第6行,在from中。导入哈希表、tslib、lib 文件“numpy.pxd”,第157行,在init pandas.hashtable(pandas/hashtable.c:22331)中 ValueError:numpy.dtype大小错误,请尝试重新编译
如何修复此错误并使pandas正确加载?

您可以安装pandas的早期版本

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

在我的情况下,它解决了问题…

卸载numpy和pandas,并尝试从源代码安装pandas

pip uninstall numpy
pip uninstall pandas
git clone git://github.com/pydata/pandas.git
cd pandas
python setup.py install

这对我很有效,我现在可以使用最新版本的熊猫了

您可以从其git repo安装pandas,而无需显式克隆它

pip install git+https://github.com/pydata/pandas.git
这对我很管用

sudo pip install pandas
sudo easy_install --upgrade numpy

还应该重新调整所有内容。

打开python,检查numpy的导入版本

很可能您安装了多个numpy,python总是抓取旧的numpy,只要确保删除旧的numpy就可以解决问题

>>> import numpy as np
>>> np.__version__
>>> np.__file__
#if numpy version <= 1.7 would have the error
#find the file and delete it from (np.__file__)
>>将numpy作为np导入
>>>np.\u版本__
>>>np.\u文件__

#如果numpy版本
pip卸载numpy
卸载旧版本的numpy


pip install numpy
查找并安装最新版本的numpy

看起来也有类似的问题-您是否找到了一种不降级的解决方法?我想试用0.14版本。它看起来很相似,但这个问题(以及我当前的问题)的独特之处在于,重新编译是毫无意义的:与其他问题不同,这个问题明确说明我们是从头开始安装的,而这个库仍然不起作用。“try-recompilding”输出是一个骗局。这导致了我的问题。当我运行
pipfreeze
时,它打印出版本1.9.2,但当我打开python终端并运行
np.\uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu。谢谢对我有用的是