(升级或卸载Python导致 yum出错)
一: 升级python导致yum出错
1. cd /usr/bin/yum
2. #!/usr/bin/python 修改为 #!/usr/bin/python2.6
二 :完全重装python和yum(卸载系统的安装的python)
<1> 删除python包
1. whereis python # 查看当前系统安装的python包
2. rpm -qa|grep python|xargs rpm -ev –allmatches –nodeps ##强制删除系统安装程序python包及其相关
3. whereis python |xargs rm -frv ##删除所有残余文件 ##xargs,允许你对输出执行其他某些命令
4. whereis python ##验证删除,返回无结果
<2> 删除现有yum
1.rpm -qa|grep yum|xargs rpm -ev –allmatches –nodeps
2. whereis yum |xargs rm -frv
<3>下载相应的rpm包 (centos6版本) http://mirrors.ustc.edu.cn/centos/6/os/x86_64/Packages/
注意:rpm包的版本会更新,查看上面链接的源 具体下载
1.下载相应的rpm包
wget http://mirrors.ustc.edu.cn/centos/6/os/x86_64/Packages/python-2.6.6-66.el6_8.x86_64.rpm
wget http://mirrors.ustc.edu.cn/centos/6/os/x86_64/Packages/python-devel-2.6.6-66.el6_8.x86_64.rpm
wget http://mirrors.ustc.edu.cn/centos/6/os/x86_64/Packages/python-libs-2.6.6-66.el6_8.x86_64.rpm
wget http://mirrors.ustc.edu.cn/centos/6/os/x86_64/Packages/python-pycurl-7.19.0-9.el6.x86_64.rpm
wgt http://mirrors.ustc.edu.cn/centos/6/os/x86_64/Packages/python-setuptools-0.6.10-4.el6_9.noarch.rpm
wget http://mirrors.ustc.edu.cn/centos/6/os/x86_64/Packages/python-urlgrabber-3.9.1-11.el6.noarch.rpm
wget http://mirrors.ustc.edu.cn/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
wget http://mirrors.ustc.edu.cn/centos/6/os/x86_64/Packages/rpm-python-4.8.0-59.el6.x86_64.rpm
wget http://mirrors.ustc.edu.cn/centos/6/os/x86_64/Packages/yum-3.2.29-81.el6.centos.noarch.rpm
wget http://mirrors.ustc.edu.cn/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
wget http://mirrors.ustc.edu.cn/centos/6/os/x86_64/Packages/yum-utils-1.1.30-41.el6.noarch.rpm
wget http://mirrors.ustc.edu.cn/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-41.el6.noarch.rpm
wget http://mirrors.ustc.edu.cn/centos/6/os/x86_64/Packages/yum-plugin-protectbase-1.1.30-41.el6.noarch.rpm
wget http://mirrors.ustc.edu.cn/centos/6/os/x86_64/Packages/yum-plugin-aliases-1.1.30-41.el6.noarch.rpm
http://mirrors.163.com/centos 更换源为国内源, 速度较快
2. rpm相应包
rpm -Uvh –replacepkgs python*.rpm
rpm -Uvh –force –nodeps –replacepkgs rpm-python*.rpm yum*.rpm (–force –nodeps 强制安装 解决依赖问题)
https://blog.csdn.net/inte_sleeper/article/details/6614190 解决libpython2.6.so.1.0库无法找到问题