#centos7 默认python版本是2.7
# 所以安装的pip也要支持py2
yum install python2-pip -y
# 安装之后默认版本较低
pip (8.1.2)
# 在提示升级时 可能会遇到我这种错误
pip install --upgrade pip
Collecting pip
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/52/e1/06c018197d8151383f66ebf6979d951995cf495629fc54149491f5d157d0/pip-21.2.4.tar.gz (1.6MB)
100% |████████████████████████████████| 1.6MB 38.3MB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 1, in
File "/tmp/pip-build-FowQl4/pip/setup.py", line 7
def read(rel_path: str) -> str:
^
SyntaxError: invalid syntax
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-FowQl4/pip/
You are using pip version 8.1.2, however version 21.2.4 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
解决方法
https://bootstrap.pypa.io 去这个网站找到对应的版本升级
wget https://bootstrap.pypa.io/pip/2.7/get-pip.py
python get-pip.py
pip -V
pip 20.3.4 from /usr/lib/python2.7/site-packages/pip (python 2.7)