python与yum的修复

  装python3.10时删了python3.7,结果导致yum也完蛋了。恢复的思路:彻底删除python和yum后重装。

一、删除:

1、卸载现有python

rpm -qa | grep python | xargs rpm -ev --allmatches --nodeps ##卸载python
whereis python | xargs rm -frv ##删除所有参与文件
whereis python ##验证删除,返回无结果

2、删除现有的yum

rpm -qa | grep yum | xargs rpm -ev --allmatches --nodeps #删除yum
whereis yum | xargs rm -frv #删除残留文件
whereis yum #验证删除完成

二、安装(相关的下载文件源根据自己的操作系统进行替换):

1、按以下顺序安装python

rpm -ivh --nodeps http://vault.centos.org/7.4.1708/os/x86_64/Packages/python-2.7.5-58.el7.x86_64.rpm
rpm -ivh --nodeps http://vault.centos.org/7.4.1708/os/x86_64/Packages/python-devel-2.7.5-58.el7.x86_64.rpm
rpm -ivh --nodeps http://vault.centos.org/7.4.1708/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm
rpm -ivh --nodeps http://vault.centos.org/7.4.1708/os/x86_64/Packages/python-libs-2.7.5-58.el7.x86_64.rpm
rpm -ivh --nodeps http://vault.centos.org/7.4.1708/os/x86_64/Packages/python-pycurl-7.19.0-19.el7.x86_64.rpm
rpm -ivh --nodeps http://vault.centos.org/7.4.1708/os/x86_64/Packages/python-urlgrabber-3.10-8.el7.noarch.rpm
rpm -ivh --nodeps http://vault.centos.org/7.4.1708/os/x86_64/Packages/rpm-python-4.11.3-25.el7.x86_64.rpm

2、按以下顺序安装yum

rpm -ivh --nodeps http://vault.centos.org/7.4.1708/os/x86_64/Packages/yum-3.4.3-154.el7.centos.noarch.rpm
rpm -ivh --nodeps http://vault.centos.org/7.4.1708/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
rpm -ivh --nodeps http://vault.centos.org/7.4.1708/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-42.el7.noarch.rpm

三、验证

 

posted @ 2024-01-05 18:34  badwood  阅读(99)  评论(0编辑  收藏  举报
Badwood's Blog