pip install numpy (python 2.7) 失败,错误代码为 1

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

pip install numpy (python 2.7) fails with errorcode 1

pythonnumpypip

提问by Jonathan Brouwer

I'm installing numpy through pip on python 2.7.9... I checked pip list, and it returns pip (1.5.6), setuptools (12.0.4). I'm running on Windows 7 64-bit, and I've tried both Python 32 and 64-bit versions.

我正在通过 pip 在 python 2.7.9 上安装 numpy ......我检查了pip list,它返回pip (1.5.6), setuptools (12.0.4). 我在 Windows 7 64 位上运行,并且我尝试了 Python 32 和 64 位版本。

pip install numpyends with:

pip install numpy以。。结束:

Command C:\Python27\python.exe -c "import setuptools, tokenize;__file__='c:\users\jon\appdata\local\temp\pip_build_jon\numpy\setup.py';exec(compile(getattr(tokenize, 'open', open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\jon\appdata\local\temp\pip-qnynnf-record\install-record.txt --single-version-externally-managed 

--compile failed with error code 1 in c:\users\jon\appdata\local\temp\pip_build_jon\numpyStoring 

debug log for failure in C:\Users\jon\pip\pip.log

When I checked stackoverflow for other posts about errorcode 1, their solutions were to make sure you have an up-to-date version of setuptools. I installed Python 2.7.9 from the main website, and it comes with both setuptoolsand pipready to go. Plus I made sure my system had them installed by checking pip list.

当我在 stackoverflow 上查看有关错误代码 1 的其他帖子时,他们的解决方案是确保您拥有最新版本的setuptools. 我从主网站安装了 Python 2.7.9,它同时提供setuptoolspip随时可用。另外,我通过检查确保我的系统安装了它们pip list

So instead I looked up the debug log the console error told me to go to, at C:\Users\jon\pip\pip.log. It's quite lengthy, but near the end it says

因此,我查看了控制台错误告诉我要去的调试日志,位于C:\Users\jon\pip\pip.log. 它很长,但接近尾声它说

error: Microsoft Visual C++ 9.0 is required (Unable to find vcvarsall.bat). Get it from http://aka.ms/vcpython27

I went to that url, downloaded the compiler, and ran pip install numpyagain. It didn't throw errorcode 1 this time, but had a different issue. It printed a huge wall of text to the screen, which never happened the last time I installed numpy/matplotlib/etc. It printed the text for a few minutes, then froze and stopped.

我去了那个网址,下载了编译器,然后pip install numpy再次运行。这次它没有抛出错误代码 1,但有一个不同的问题。它在屏幕上打印了一堵巨大的文字墙,这在我上次安装 numpy/matplotlib/etc 时从未发生过。它打印了几分钟的文本,然后冻结并停止。

I'm not sure how to proceed?

我不确定如何进行?

If it helps I can post the pip debug log.

如果有帮助,我可以发布 pip 调试日志。

采纳答案by Malik Brahimi

Download the wheel (.whl file) file from hereand install with pip:

这里下载轮子(.whl 文件)文件并使用 pip 安装:

  1. pip install wheelto install support for wheel files.
  2. pip install numpy?1.9.1+mkl?cp27?none?win32.whlto install the wheel.
  1. pip install wheel安装对轮文件的支持。
  2. pip install numpy?1.9.1+mkl?cp27?none?win32.whl安装车轮。