pip安装numpy失败,错误代码1

4

我正在尝试使用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
6个回答

9
安装扩展模块使用pip可能会出现问题。这就是为什么conda存在的原因。conda是一个开源的、BSD许可证的跨平台包管理器。它可以轻松地安装NumPy。
两个选项:
- 安装Anaconda - 安装Miniconda,然后进入命令行并输入conda install numpy(确保您的PATH包括conda安装的位置)。

1
一些文件无法使用pip安装,需要从平台包中安装。如果上述方法不起作用,您可以尝试以下操作。 MAC 使用Macports。
sudo port install 'package' 

使用 Homebrew:
brew install 'Package'

1
我猜测这是因为pip 1.3在处理ssl时存在错误。 这里有一个链接 here

1

确保已安装python-dev(如果未安装,您肯定会看到相同的错误)。

dpkg -l python-dev

1
如果您正在使用Python 3+,请尝试使用pip3进行安装。
    pip3 install numpy

另外一件事(Windows),请确保您安装了最新版本的Microsoft Visual C++。


0
我下载了Python 3.7,并自定义了安装位置。然后我尝试使用pip安装numpy,但失败了,错误代码为1。 然后我删除了Python 3.7,下载了Python 3.6,没有自定义安装位置。然后我使用pip安装numpy:成功了。 也许自定义安装位置导致了错误。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接