重装python2.7+yum

首先,卸载干净:

rpm -qa|grep python|xargs rpm -e --allmatches --nodeps
 
whereis python|xargs rm -fr

rpm -qa|grep yum|xargs rpm -e --allmatches --nodeps
 
rm -rf /etc/yum.repos.d/*
 
whereis yum|xargs rm -fr

然后

cat /etc/redhat-release
uname -a

查看系统版本,

然后去http://vault.centos.org/找到系统对应的版本号,找到url依次下载,

巨坑慎入:

 

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


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

 

 安装:

rpm -ivh python-*   rpm-python-*
rpm -ivh yum-*

 

sudo vim /usr/bin/yum

把文件头部的#!/usr/bin/python改成#!/usr/bin/python2.7保存退出即可.

/usr/libexec/urlgrabber-ext-down看看,发下他也使用了/usr/bin/python,于是跟前面一样,改为2.7,完成。

 

posted on 2018-07-25 23:54 东篱南山 阅读(...) 评论(...) 编辑 收藏

Powered by .NET Core 3.0 Preview 8 on Linux

导航

统计