Centos 7删除python2.7后yum无法使用了


0, 曾经手贱了几次, 也重装了好几次, 还是记下来吧…


1, 删除现有python

1
2
rpm -qa|grep python|xargs rpm -ev --allmatches --nodeps


2, 删除现有yum

1
rpm -qa|grep yum|xargs rpm -ev --allmatches --nodeps

3, 重新下载rpm安装包, 注意版本号, 可能和下面的不一致.

https://mirrors.ustc.edu.cn/centos/7.9.2009/os/x86_64/Packages/

1
2
3
4
5
6
7
8
9
10
11
12
13
14
python-2.7.5-88.el7.x86_64.rpm
python-devel-2.7.5-88.el7.x86_64.rpm
python-libs-2.7.5-88.el7.x86_64.rpm
python-pycurl-7.19.0-19.el7.x86_64.rpm
python-setuptools-0.9.8-7.el7.noarch.rpm
python-urlgrabber-3.10-10.el7.noarch.rpm
python-iniparse-0.4-9.el7.noarch.rpm
rpm-python-4.11.3-43.el7.x86_64.rpm
yum-3.4.3-167.el7.centos.noarch.rpm
yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
yum-utils-1.1.31-53.el7.noarch.rpm
yum-plugin-fastestmirror-1.1.31-53.el7.noarch.rpm
yum-plugin-protectbase-1.1.31-53.el7.noarch.rpm
yum-plugin-aliases-1.1.31-53.el7.noarch.rpm

4, 安装下载下来的rpm包

1
2
rpm -Uvh --replacepkgs python*.rpm
rpm -Uvh --replacepkgs rpm-python*.rpm yum*.rpm

5. 验证yum是否可用!

Snipaste_2020-09-23_18-17-37.png
已经满血复活了!