1.删除yum和pathon
rpm -qa|grep python|xargs rpm -ev --allmatches --nodeps ##强制删除已安装程序及其关联 whereis python |xargs rm -frv ##删除所有残余文件 ##xargs,允许你对输出执行其他某些命令 whereis python ##验证删除,返回无结果 rpm -qa|grep yum|xargs rpm -ev --allmatches --nodeps whereis yum |xargs rm -frv
2.下载rpm包 根据系统版本搜索基础包和升级包
http://mirror.centos.org/centos/7.9.2009/os/x86_64/Packages/
RPM resource yum-utils(x86-64)
RPM Search
libxml2-2.9.1-6.el7_9.6.x86_64.rpm libxml2-python-2.9.1-6.el7_9.6.x86_64.rpm python-2.7.5-89.el7.x86_64.rpm python2-rpm-macros-3-34.el7.noarch.rpm python-backports-1.0-8.el7.x86_64.rpm python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch.rpm python-chardet-2.2.1-3.el7.noarch.rpm python-devel-2.7.5-89.el7.x86_64.rpm python-iniparse-0.4-9.el7.noarch.rpm python-ipaddress-1.0.16-2.el7.noarch.rpm python-kitchen-1.1.1-5.el7.noarch.rpm python-libs-2.7.5-89.el7.x86_64.rpm python-pycurl-7.19.0-19.el7.x86_64.rpm python-rpm-macros-3-34.el7.noarch.rpm python-setuptools-0.9.8-7.el7.noarch.rpm python-srpm-macros-3-34.el7.noarch.rpm python-urlgrabber-3.10-10.el7.noarch.rpm rpm-4.11.3-45.el7.x86_64.rpm.1 rpm-4.11.3-48.el7_9.x86_64.rpm rpm-python-4.11.3-48.el7_9.x86_64.rpm yum-3.4.3-168.el7.centos.noarch.rpm yum-metadata-parser-1.1.4-10.el7.x86_64.rpm yum-plugin-aliases-1.1.31-54.el7_8.noarch.rpm yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm yum-plugin-protectbase-1.1.31-54.el7_8.noarch.rpm yum-utils-1.1.31-54.el7_8.noarch.rpm
3.安装
rpm -Uvh --replacepkgs *.rpm