Python Numpy 构建失败,无法导入多数组

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21324426/
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-08-18 22:35:54  来源:igfitidea点击:

Numpy build fails with cannot import multiarray

pythonmacospython-2.7numpyhomebrew

提问by ngoldbaum

I'm using homebrew python on Mavericks, trying to build numpy 1.8. Unfortunately, when I try to install numpy, I get the following error: https://gist.github.com/ngoldbaum/8592039

我在 Mavericks 上使用自制的 python,试图构建 numpy 1.8。不幸的是,当我尝试安装 numpy 时,出现以下错误:https: //gist.github.com/ngoldbaum/8592039

I'm able to build numpy 1.7.2 with pip install numpy==1.7.2, but numpy 1.8 always fails to build with the same traceback.

我可以使用 构建 numpy 1.7.2 pip install numpy==1.7.2,但是 numpy 1.8 总是无法使用相同的回溯构建。

采纳答案by Brian

on Mac:

在 Mac 上:

1.) remove these 2 folders manually:

1.) 手动删除这 2 个文件夹:

rm -rf /usr/local/lib/python2.7/site-packages/numpy/
rm -rf /usr/local/lib/python2.7/site-packages/numpy-1.10.4.dist-info/

notice: pip uninstall numpydidn't work for me, I had to remove numpy manually.

注意:pip uninstall numpy对我不起作用,我不得不手动删除 numpy。

2.) re-install numpy: pip install numpy

2.) 重新安装numpy: pip install numpy

回答by ngoldbaum

This was solved by doing brew uninstall python, deleting the contents of /usr/local/lib/python2.7/site-packages, reinstalling python, and then rebuilding numpy.

这是通过执行brew uninstall python,删除内容/usr/local/lib/python2.7/site-packages,重新安装python,然后重建numpy来解决的。

回答by Jose Solis Jr.

I solved my issue doing this: Python.exe .\lib\site-packages\easy_install.py

我这样做解决了我的问题: Python.exe .\lib\site-packages\easy_install.py

回答by vikash singh

I solved it by uninstalling numpy and reinstalling numpy using pip -

我通过卸载 numpy 并使用 pip 重新安装 numpy 来解决它 -

pip3 uninstall numpy

pip3 install numpy