pip升级失败解决

解决该问题参考了此篇博文: pip2升级报错 ( def read(rel_path: str) ->str: )
环境

机器:centos: 7
python版本:2.7.4(Linux自带python)

1、遇到问题的原因

学习docker的过程中,了解到docker-compose插件,于是选择pip安装docker-compose插件。

2、pip安装和更新

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

问题出现: pip2升级报错 ( def read(rel_path: str) ->str: )注:由于在总结这个问题时,没有留图所以借鉴了参考博文的一张图片,对此表示感谢。

3、解决方法

如果无法更新到最新版本,则指定更新版本

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将删除对该功能的支持。

所以pip想更新到21.0及以上版本需要自己升级python版本。谢谢您的阅览,希望对您有所帮助。

来源:吴明_yst

物联沃分享整理
物联沃-IOTWORD物联网 » pip升级失败解决

发表评论