python2.7无法使用pip21安装包,因为在pip21版本停止对python2.7的支持
提示报错
Successfully installed pip-21.0.1
Traceback (most recent call last):
File "/usr/local/bin/pip", line 7, in <module>
from pip._internal.cli.main import main
File "/usr/local/lib/python2.7/dist-packages/pip/_internal/cli/main.py", line 60
sys.stderr.write(f"ERROR: {exc}")
^
SyntaxError: invalid syntax
install base requisite fail,the script aborts.
从官网下载pip20版本,并进行安装,之后不更新Pip即可
root@Ubuntu# apt purge python-pip
root@Ubuntu# apt purge python3-pip
root@Ubuntu# wget https://files.pythonhosted.org/packages/53/7f/55721ad0501a9076dbc354cc8c63ffc2d6f1ef360f49ad0fbcce19d68538/pip-20.3.4.tar.gz
root@Ubuntu#tar -zxvf pip-20.3.4.tar.gz
root@Ubuntu#cd pip-20.3.4.tar.gz
root@Ubuntu#python setup.py install
root@Ubuntu#python3 setup.py install