Python pip 无法安装 numpy 错误代码 1

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

pip fails to install numpy error code 1

pythonpython-2.7numpypip

提问by Pim

I'm trying to install numpy using pip. When I type pip install numpyin the command prompt it goes to work but won't install the file and returns an error code 1. I am using windows 8 64-Bit and python 2.7.This is the final bit of the error message

我正在尝试使用 pip 安装 numpy。当我pip install numpy在命令提示符下输入时,它会工作,但不会安装文件并返回错误代码1。我正在使用 windows 8 64 位和 python 2.7。这是错误消息的最后一点

Cleaning up...

Removing temporary dir c:\users\pim\appdata\local\temp\pip_build_Pim...
Command python setup.py egg_info failed with error code 1 in c:\users\pim\appdata\local\temp\pip_build_Pim\numpy

Exception information:
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\pip-1.4.1-py2.7.egg\pip\basecommand.py", line 134, in main
    status = self.run(options, args)
  File "C:\Python27\lib\site-packages\pip-1.4.1-py2.7.egg\pip\commands\install.py", line 236, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "C:\Python27\lib\site-packages\pip-1.4.1-py2.7.egg\pip\req.py", line 1134, in prepare_files
    req_to_install.run_egg_info()
  File "C:\Python27\lib\site-packages\pip-1.4.1-py2.7.egg\pip\req.py", line 259, in run_egg_info
    command_desc='python setup.py egg_info')
  File "C:\Python27\lib\site-packages\pip-1.4.1-py2.7.egg\pip\util.py", line 670, in call_subprocess
    % (command_desc, proc.returncode, cwd))
InstallationError: Command python setup.py egg_info failed with error code 1 in c:\users\pim\appdata\local\temp\pip_build_Pim\numpy

采纳答案by Travis Oliphant

Installing extension modules can be an issue with pip. This is why conda exists. conda is an open-source BSD-licensed cross-platform package manager. It can easily install NumPy.

安装扩展模块可能是 pip 的问题。这就是 conda 存在的原因。conda 是一个开源的 BSD 许可的跨平台包管理器。它可以轻松安装 NumPy。

Two options:

两种选择:

回答by TonyTony

I would guess this is due to pip 1.3 has a bug dealing with ssl. There is a link here.

我猜这是因为 pip 1.3 有一个处理 ssl 的错误。有一个链接在这里

回答by beep_check

Make sure you have python-dev installed (as you'll definitely see this same error if you don't).

确保你已经安装了 python-dev(如果你不安装,你肯定会看到同样的错误)。

dpkg -l python-dev

回答by Fenici

Some File can not be installed with pip and need to be installed from your platform's packages.

有些文件不能用 pip 安装,需要从你平台的包中安装。

So You guys can try this if nth work up there MACWith Macports

所以你们可以试试这个,如果第 n 个工作在那里 MACWith Macports

sudo port install 'package' 

With Homebrew:

使用自制软件:

brew install 'Package'

回答by Elang TA

I downloaded python 37, and I customized install location. Then I tried to install numpy using pip: failed error code 1. Then I deleted python 37, downloaded python 36 without customizing install location. Then I installed numpy using pip: successful. Perhaps customizing install location caused the error.

我下载了 python 37,并自定义了安装位置。然后我尝试使用 pip: failed error code 1 安装 numpy。然后我删除了 python 37,下载了 python 36 而不自定义安装位置。然后我使用 pip: 成功安装了 numpy。也许自定义安装位置导致了错误。

回答by Egoalterum

if you are using python 3+ try to install with pip3

如果您使用的是 python 3+ 尝试使用 pip3 安装

    pip3 install numpy

another thing (windows) make sure you have the latest version of Microsoft Visual C++

另一件事(Windows)确保您拥有最新版本的 Microsoft Visual C++