简体   繁体   中英

pip install --upgrade pip installs the same version

Somehow pip --upgrade doesn't upgrade any packages.

I'm on OSX El Capitan (10.11.3) and installed python using brew install python

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

After successful install I run pip install --upgrade pip .

Full output:

$ 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.

Why doesn't pip install the new version?

Update

I think it has something to do with my ~/.pydistutils.cfg file which fixes the DistutilsOptionError: must supply either home or prefix/exec-prefix -- not both error when running pip . I followed these instructions

Related SO question

$ 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

Getting annoyed by things not working I created a new OSX profile. In the new profile everything was working fine so after investigating further I found a file ~/Library/Application\\ Support/pip/pip.conf in my main profile containing:

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

I don't know how it got there but removing it resolved the issue.

This also resolved the need for the ~/.pydistutils.cfg file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM