python2.7不能正常使用的解决方法

我是在使用docker-compose的时候出现如下的报错:
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。
经过查找资料,和一番验证之后,最后的解决方法还是挺简单的。

~:yum -y install python3-pip
~:python3 -m pip install --upgrade pip
~:pip3 install docker-compose

这个时候输入python、pip的时候就要加上数字3了。在python2.7能正常使用的时候用着三步就可以解决了。要是没有解决可以试试更新一下yum,remove掉python2.7,重新装python3。

yum -y update 
yum -y remove python2.7 
©️2020 CSDN 皮肤主题: 数字20 设计师:CSDN官方博客 返回首页