简体   繁体   English

安装特定版本后pip无法升级

[英]pip does not upgrade after installing a specific version

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

Why no upgrade happens below ? 为什么下面没有升级?

$ 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 ~]$ 

pip 9 is the last version that works under Python 2.6: pip 9是可在Python 2.6下运行的最新版本:

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

Python 2.6 is no longer supported - if you need pip on Python 2.6, you should stay on pip 9, which is the last version to support Python 2.6. 不再支持Python 2.6-如果您需要在Python 2.6上使用pip,则应继续使用pip 9,这是支持Python 2.6的最新版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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