Python Pandas:导入熊猫时找不到 numpy.core.multiarray
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9641916/
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
Python Pandas: can't find numpy.core.multiarray when importing pandas
提问by Dylan Cutler
I'm trying to get my code (running in eclipse) to import pandas.
我正在尝试让我的代码(在 eclipse 中运行)导入熊猫。
I get the following error: "ImportError: numpy.core.multiarray failed to import"when I try to import pandas. I'm using python2.7, pandas 0.7.1, and numpy 1.5.1
我收到以下错误:"ImportError: numpy.core.multiarray failed to import"当我尝试导入熊猫时。我正在使用python2.7, pandas 0.7.1, 和numpy 1.5.1
回答by Pierre GM
Just to make sure:
只想确认一下:
- Did you install pandas from the sources ? Make sure it's using the version of NumPy you want.
- Did you upgrade NumPy after installing pandas? Make sure to recompile pandas, as there can be some changes in the ABI (but w/ that version of NumPy, I doubt it's the case)
- Are you calling pandas and/or Numpy from their source directory ? Bad idea, NumPy tends to choke on that.
- 您是否从源代码安装了熊猫?确保它使用的是您想要的 NumPy 版本。
- 安装pandas后是否升级了NumPy?确保重新编译 Pandas,因为 ABI 中可能会有一些变化(但是使用那个版本的 NumPy,我怀疑是这种情况)
- 您是从它们的源目录中调用 pandas 和/或 Numpy 吗?坏主意,NumPy 往往会窒息。
回答by Qiau
Try to update to numpy version 1.6.1. Helped for me!
尝试更新到 numpy 版本 1.6.1。对我有帮助!
回答by Keith C Campbell
Might be a 32-bit vs 64-bit compatibility issue. See: how to install numpy and scipy on OS X?
可能是 32 位与 64 位兼容性问题。请参阅: 如何在 OS X 上安装 numpy 和 scipy?
Despite the title, similar problems can occur with other operating systems if you mix 32-bit and 64-fit versions.
尽管有标题,但如果混合使用 32 位和 64 位版本,其他操作系统也会出现类似问题。
回答by Madison May
@user248237:
@用户248237:
I second Keith's suggestion that its probably a 32/64 bit compatibility issue. I ran into the same problem just this week while trying to install a different module. Check the versions of each of your modules and make everything matches. In general, I would stick to the 32 bit versions -- not all modules have official 64 bit support. I uninstalled my 64 bit version of python and replaced it with a 32 bit one, reinstalled the modules, and haven't had any problems since.
我支持 Keith 的建议,它可能是 32/64 位兼容性问题。就在本周,我在尝试安装不同的模块时遇到了同样的问题。检查每个模块的版本并使所有内容匹配。一般来说,我会坚持使用 32 位版本——并非所有模块都有官方的 64 位支持。我卸载了 64 位版本的 python 并将其替换为 32 位版本,重新安装了模块,此后没有出现任何问题。

