安装特定版本后,pip不会升级

时间:2018-05-17 23:33:32

标签: python pip python-packaging

$ lsb_release -a
LSB Version:    :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: CentOS
Description:    CentOS release 6.7 (Final)
Release:    6.7
Codename:   Final

$ sudo yum -y erase python-pip

$ ls -l /usr/bin/pip*
ls: cannot access /usr/bin/pip*: No such file or directory

$ sudo yum -y install python-pip
Running Transaction
  Installing : python-pip-7.1.0-1.el6.noarch                                                                                                             1/1 
  Verifying  : python-pip-7.1.0-1.el6.noarch                                                                                                             1/1 

Installed:
  python-pip.noarch 0:7.1.0-1.el6                                                                                                                            

Complete!

$ /usr/bin/pip --version
pip 7.1.0 from /usr/lib/python2.6/site-packages (python 2.6)
$ /usr/bin/pip2 --version
pip 7.1.0 from /usr/lib/python2.6/site-packages (python 2.6)
$ /usr/bin/pip2.6 --version
pip 7.1.0 from /usr/lib/python2.6/site-packages (python 2.6)

$ sudo pip2.6 install pip==9.0.3
You are using pip version 7.1.0, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting pip==9.0.3
  Using cached https://files.pythonhosted.org/packages/ac/95/a05b56bb975efa78d3557efa36acaf9cf5d2fd0ee0062060493687432e03/pip-9.0.3-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 7.1.0
    Uninstalling pip-7.1.0:
      Successfully uninstalled pip-7.1.0
Successfully installed pip-9.0.0

$ /usr/bin/pip --version
pip 9.0.3 from /usr/lib/python2.6/site-packages (python 2.6)
$ /usr/bin/pip2 --version
pip 9.0.3 from /usr/lib/python2.6/site-packages (python 2.6)
$ /usr/bin/pip2.6 --version
pip 9.0.3 from /usr/lib/python2.6/site-packages (python 2.6)

为什么下面没有升级?

$ sudo pip2.6 install --upgrade pip 
DEPRECATION: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of pip will drop support for Python 2.6
/usr/lib/python2.6/site-packages/pip/_vendor/urllib3/util/ssl_.py:339: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  SNIMissingWarning
/usr/lib/python2.6/site-packages/pip/_vendor/urllib3/util/ssl_.py:137: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecurePlatformWarning
Requirement already up-to-date: pip in /usr/lib/python2.6/site-packages
You are using pip version 9.0.3, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.


$ /usr/bin/pip --version
pip 9.0.3 from /usr/lib/python2.6/site-packages (python 2.6)
$ /usr/bin/pip2 --version
pip 9.0.3 from /usr/lib/python2.6/site-packages (python 2.6)
$ /usr/bin/pip2.6 --version
pip 9.0.3 from /usr/lib/python2.6/site-packages (python 2.6)
[vagrant@localhost ~]$ 

1 个答案:

答案 0 :(得分:1)

pip 9是在Python 2.6下运行的最后一个版本:

https://blog.python.org/2018/04/pip-10-has-been-released.html

不再支持Python 2.6 - 如果你需要在Python 2.6上使用pip,你应该继续使用pip 9,这是支持Python 2.6的最后一个版本。