重新安裝python2.6 和 yum (不可以直接安裝yum yum 依賴於python2.6)
(升級或解除安裝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
2. rpm相應包
rpm -Uvh --replacepkgs python*.rpm
rpm -Uvh --force --nodeps --replacepkgs rpm-python*.rpm yum*.rpm (--force --nodeps 強制安裝 解決依賴問題)
文章來源於:
http://blog.51cto.com/smilepad/1333478(安裝python2.6 和yum)
https://segmentfault.com/q/1010000009194060/a-1020000010325662 (rpm 安裝依賴問題):
rpm -ivh yum-3.2.29-81.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-40.el6.noarch.rpm