centos删除python导致yum不可用的解决方法

需要完全删除python和yum,然后重新安装,因为这样比解决依赖问题更快捷.

1、完全删除现有的python,强制删除已安装程序和其相关联的依赖

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

强制干掉所有的残余文件
whereis python |xargs rm -frv

2、删除现有的yum

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

3、强制删除所有残余文件
whereis yum |xargs rm -frv

4、下载版本对应的rpm包(这点很重要,要找对自己的系统版本,还要找对对应的包)
下面的包是会定期更新的,下载的时候需要去镜像网站找到对应的包,不要漏掉任何一个,其他的镜像站,比如163也可以,速度快就好.要不然下载这些包都是煎熬

wget http://mirrors.ustc.edu.cn/centos/7/os/x86_64/Packages/libxml2-python-2.9.1-6.el7_2.3.x86_64.rpm

wget http://mirrors.ustc.edu.cn/centos/7/os/x86_64/Packages/rpm-4.11.3-35.el7.x86_64.rpm
wget http://mirrors.ustc.edu.cn/centos/7/os/x86_64/Packages/rpm-build-4.11.3-35.el7.x86_64.rpm
wget http://mirrors.ustc.edu.cn/centos/7/os/x86_64/Packages/rpm-build-libs-4.11.3-35.el7.x86_64.rpm
wget http://mirrors.ustc.edu.cn/centos/7/os/x86_64/Packages/rpm-libs-4.11.3-35.el7.x86_64.rpm
wget http://mirrors.ustc.edu.cn/centos/7/os/x86_64/Packages/rpm-sign-4.11.3-35.el7.x86_64.rpm
wget http://mirrors.ustc.edu.cn/centos/7/os/x86_64/Packages/rpm-python-4.11.3-35.el7.x86_64.rpm

wget http://mirrors.ustc.edu.cn/centos/7/os/x86_64/Packages/python-2.7.5-76.el7.x86_64.rpm
wget http://mirrors.ustc.edu.cn/centos/7/os/x86_64/Packages/python-devel-2.7.5-76.el7.x86_64.rpm
wget http://mirrors.ustc.edu.cn/centos/7/os/x86_64/Packages/python-libs-2.7.5-76.el7.x86_64.rpm
wget http://mirrors.ustc.edu.cn/centos/7/os/x86_64/Packages/python-pycurl-7.19.0-19.el7.x86_64.rpm
wget http://mirrors.ustc.edu.cn/centos/7/os/x86_64/Packages/python-setuptools-0.9.8-7.el7.noarch.rpm
wget http://mirrors.ustc.edu.cn/centos/7/os/x86_64/Packages/python-urlgrabber-3.10-9.el7.noarch.rpm
wget http://mirrors.ustc.edu.cn/centos/7/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm
wget http://mirrors.ustc.edu.cn/centos/7/os/x86_64/Packages/python-backports-1.0-8.el7.x86_64.rpm
wget http://mirrors.ustc.edu.cn/centos/7/os/x86_64/Packages/python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch.rpm
wget http://mirrors.ustc.edu.cn/centos/7/os/x86_64/Packages/python-chardet-2.2.1-1.el7_1.noarch.rpm
wget http://mirrors.ustc.edu.cn/centos/7/os/x86_64/Packages/python-ipaddress-1.0.16-2.el7.noarch.rpm
wget http://mirrors.ustc.edu.cn/centos/7/os/x86_64/Packages/python-kitchen-1.1.1-5.el7.noarch.rpm
wget http://mirrors.ustc.edu.cn/centos/7/os/x86_64/Packages/python-virtualenv-15.1.0-2.el7.noarch.rpm

wget http://mirrors.ustc.edu.cn/centos/7/os/x86_64/Packages/yum-3.4.3-161.el7.centos.noarch.rpm
wget http://mirrors.ustc.edu.cn/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget http://mirrors.ustc.edu.cn/centos/7/os/x86_64/Packages/yum-utils-1.1.31-50.el7.noarch.rpm
wget http://mirrors.ustc.edu.cn/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-50.el7.noarch.rpm
wget http://mirrors.ustc.edu.cn/centos/7/os/x86_64/Packages/yum-plugin-protectbase-1.1.31-50.el7.noarch.rpm
wget http://mirrors.ustc.edu.cn/centos/7/os/x86_64/Packages/yum-plugin-aliases-1.1.31-50.el7.noarch.rpm

下载完成后安装这些包(--force强制安装)

rpm -Uvh --force --nodeps --replacepkgs *.rpm

然后yum.就可以了,

**********这个是centos7, 要根据packages的版本信息,下载对应的包

你可能感兴趣的:(centos删除python导致yum不可用的解决方法)