解决该问题参考了此篇博文: pip2升级报错 ( def read(rel_path: str) ->str: )
环境
机器:centos: 7
python版本:2.7.4(Linux自带python)
学习docker的过程中,了解到docker-compose插件,于是选择pip安装docker-compose插件。
2.1、安装pip
yum -y install epel-release
yum -y install python-pip
pip --version # 8.1.2
2.2、更新pip
pip install --upgrade pip
如果无法更新到最新版本,则指定更新版本
python -m pip install --user --upgrade pip==20.2.4 #(换成你想要的版本编号)
问题解决了,但是为什么无法更新到最新版本呢。尝试后结果如下:
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
弃用:Python 2.7在2020年1月1日结束了它的生命。请升级您的Python,因为Python 2.7已不再维护。pip 21.0将在2021年1月取消对Python 2.7的支持。有关pip中Python 2支持的更多细节可以在https://pip.pypa.io/en/latest/development/release-process/#python-2-support找到pip 21.0将删除对该功能的支持。