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

标签 python numpy pip

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

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

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

因此,我改为查看调试日志,控制台错误告诉我去 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

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

我不确定如何进行?

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

最佳答案

here 下载 wheel(.whl 文件)文件并使用 pip 安装:

  1. pip install wheel 安装对 wheel 文件的支持。
  2. pip install numpy‑1.9.1+mkl‑cp27‑none‑win32.whl 安装轮子。

关于python - pip install numpy (python 2.7) 失败,错误代码为 1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28142839/

相关文章:

python - HtmlWindow 无法正确显示图像

python - 将 2D numpy 数组转换为表示灰度图像的 3d numpy 数组

python - 如何从列表列表中创建 numpy 数组

python - 将列表的数据框 reshape 为另一个数据框

python - 找不到 Pyinstaller 命令 (MacOS)

python - SQLAlchemy 名称错误 : Name 'db' is not defined (? )

python - 打印 Python 异常/错误层次结构

python - 运行命令 "conda env create -f environment.yml"后发出警告

python - 如何以编程方式在 virtualenv 中安装 Python 模块?

python - i18n 打破 Turbogears 设置 -wiki20 教程