pandas 熊猫导入错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17904600/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 21:02:13  来源:igfitidea点击:

Pandas import error

python-2.7pandaseasy-install

提问by Jugesh Sundram

I tried installing pandas using easy_installand it claimed that it successfully installed the pandas package in my Python Directory.

我尝试使用安装Pandaseasy_install,它声称它成功地在我的 Python 目录中安装了Pandas包。

I switch to IDLE and try import pandasand it throws me the following error -

我切换到 IDLE 并尝试import pandas它会引发以下错误 -

Traceback (most recent call last): File "<pyshell#0>", line 1, in <module> import pandas File "C:\Python27\lib\site-packages\pandas-0.12.0-py2.7-win32.egg\pandas\__init__.py", line 6, in <module> from . import hashtable, tslib, lib File "numpy.pxd", line 157, in init pandas.hashtable (pandas\hashtable.c:20282) ValueError: numpy.dtype has the wrong size, try recompiling

Traceback (most recent call last): File "<pyshell#0>", line 1, in <module> import pandas File "C:\Python27\lib\site-packages\pandas-0.12.0-py2.7-win32.egg\pandas\__init__.py", line 6, in <module> from . import hashtable, tslib, lib File "numpy.pxd", line 157, in init pandas.hashtable (pandas\hashtable.c:20282) ValueError: numpy.dtype has the wrong size, try recompiling

Please help me diagnose the error.

请帮我诊断错误。

FYI: I have already installed the numpypackage

仅供参考:我已经安装了该numpy软件包

回答by The Other Guy

Maybe you interrupted pandas install , retry using pip :

也许您中断了 pandas install ,请使用 pip 重试:

First install pip (if you haven't done it already) :

首先安装 pip(如果你还没有安装过):

easy_install pip

then reinstall pandas:

然后重新安装Pandas:

pip install pandas --upgrade

Hope it helps

希望能帮助到你

回答by Steve S

You know that output error you got when you tried running @nipun-batra's script?

您知道尝试运行 @nipun-batra 的脚本时遇到的输出错误吗?

Well, you got it because you have to first:

好吧,你明白了,因为你必须首先:

import platform

before you can run:

在你可以运行之前:

platform.platform()  

I know this because I--about 10 minutes ago--got the same error when trying to run the same script. The difference is that I--an absolute beginner--figured out ourproblem after a quick trip over to google. (Man, they let you search for anythingover there!)

我知道这一点是因为我——大约 10 分钟前——在尝试运行相同的脚本时遇到了同样的错误。不同之处在于我——一个绝对的初学者——在快速访问google后发现了我们的问题。(伙计,他们让你在那里搜索任何东西

This, when coupled with your follow-up appeal exactly two monthsafter your initial posting, suggests to me that you would prefer to minimize--as much as possible--the usual hardship associated with owning and operating your own computer-machine-thingy.

这一点,再加上您在最初发布后整整两个月的后续上诉,向我表明您希望尽可能减少与拥有和操作自己的计算机机器相关的常见困难.

As a result, with respect to your initial IDLE/pandasissue, your best best bet is to forget about messing around with easy_install, etc. Instead, go head on down to Continuum Analyticsand pick up your very own (free) copy of Anaconda, which has got more packages than you can shake a stick at! (Including, I might add, pandas, numpy, scipy, statsmodels, matplotlib, IPython, and many more). And the best part is that it all comes bundled together as a single easy-to-download file. Trust me, it will save you a lot of headaches if you just download everything all at once.

因此,对于您最初的IDLE/pandas问题,最好的办法是忘记使用easy_install等。相反,继续前往Continuum Analytics并获取您自己的(免费)Anaconda副本,它有更多的包裹,你可以摇一摇!(包括,我可以补充,Pandasnumpy的SciPy的statsmodelsmatplotlibIPython中还有更多)。最好的部分是所有这些都捆绑在一起作为一个易于下载的文件。相信我,如果您一次下载所有内容,它将为您省去很多麻烦。

Hope this helps!

希望这可以帮助!

回答by Harold Sarmiento

Panda does not work with python 2.7 , do you will need python 3.6 or higer

Panda 不适用于 python 2.7 ,您需要 python 3.6 或更高版本吗?