pip install --upgrade pip安装相同的版本

时间:2016-03-15 13:36:56

标签: python macos pip homebrew

不知怎的pip --upgrade没有升级任何软件包。

我在OSX El Capitan(10.11.3)上并使用brew install python安装了python

Python:/usr/local/bin/python@ -> ../Cellar/python/2.7.11/bin/python
点数:/usr/local/bin/pip@ -> ../Cellar/python/2.7.11/bin/pip

成功安装后,我运行pip install --upgrade pip

完整输出:

$ pip install --upgrade pip
Collecting pip
  Using cached pip-8.1.0-py2.py3-none-any.whl
Installing collected packages: pip
Successfully installed pip-8.0.2
You are using pip version 8.0.2, however version 8.1.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

为什么pip不安装新版本?

更新

我认为这与我的~/.pydistutils.cfg文件有关,该文件在运行DistutilsOptionError: must supply either home or prefix/exec-prefix -- not both时修复了pip错误。 I followed these instructions

Related SO question

2 个答案:

答案 0 :(得分:1)

$ sudo pip install -U pip
Collecting pip
Downloading pip-9.0.3-py2.py3-none-any.whl (1.4MB)
100% |████████████████████████████████| 1.4MB 335kB/s 
Installing collected packages: pip
Found existing installation: pip 9.0.1
Uninstalling pip-9.0.1:
  Successfully uninstalled pip-9.0.1
Successfully installed pip-9.0.3

答案 1 :(得分:0)

因无效工作而烦恼我创建了一个新的OSX配置文件。在新的配置文件中,一切正常,因此在进一步调查后,我在主配置文件中找到了一个文件~/Library/Application\ Support/pip/pip.conf,其中包含:

[global]
target=/usr/local/lib/python2.7/site-packages

我不知道它是如何实现的,但删除它解决了这个问题。

这也解决了对~/.pydistutils.cfg文件的需求。