Python2环境的PIP升级到10.0.3版本后使用pip命令报错

在Centos6中默认安装的版本是python2.6,升级pip后就会导致pip命令无法使用,具体原因如下:

If you’re attempting to upgrade the version of PIP on CentOS or RHEL 6 from the default 7.1.0 to a newer version, as of April 14th 2018 when PIP 10.0.0 was released you will run into issues since EL6 ships with Python 2.6 as standard. Since you cannot upgrade the default version of Python because it will break in-built tooling such as Yum, you’ll need to version lock PIP when you upgrade it to 9.0.3. This is the last stable version of PIP that is compatible with Python 2.6

为了解决这个问题比较直接的办法就是重新安装PIP工具:

  • PIP下载
https://pypi.python.org/packages/11/b6/abcb525026a4be042b486df43905d6893fb04f05aac21c32c638e939e447/pip-9.0.1.tar.gz#md5=35f01da33009719497f01a4ba69d63c9
  • PIP安装
tar -xzvf pip-9.0.1.tar.gz
cd pip-9.0.1
python setup.py install

参考资料:

  • CENTOS/RHEL 6 PYTHON PIP ERROR, SYNTAXERROR: INVALID SYNTAX {STR(C.VERSION) FOR C IN ALL_CANDIDATES}
  • linux 下 pip 安装教程

你可能感兴趣的:(Python2环境的PIP升级到10.0.3版本后使用pip命令报错)