最近在centos7上安裝了python3
致使yum
不能用,被其餘人卸載掉後從新安裝html
#下載yum安裝包 wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.27-14.el6.centos.noarch.rpm wget http://mirrors.163.com/centos/7/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-158.el7.centos.noarch.rpm wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-45.el7.noarch.rpm #安裝 rpm -ivh python-iniparse-0.4-9.el7.noarch. rpm -ivh yum-metadata-parser-1.1.4-10.el7.x86_64.rpm rpm -ivh yum-3.4.3-158.el7.centos.noarch.rpm #會出現問題1 wget http://mirrors.163.com/centos/7/os/x86_64/Packages/rpm-4.11.3-32.el7.x86_64.rpm rpm -Uvh rpm-4.11.3-32.el7.x86_64.rpm --nodeps rpm -ivh yum-3.4.3-158.el7.centos.noarch.rpm yum-plugin-fastestmirror-1.1.31-45.el7.noarch.rpm
錯誤:依賴檢測失敗: rpm >= 0:4.11.3-22 被 yum-3.4.3-154.el7.centos.noarch 須要 yum >= 3.0 被 yum-plugin-fastestmirror-1.1.31-45.el7.noarch 須要 解決: wget http://mirrors.163.com/centos/7/os/x86_64/Packages/rpm-4.11.3-32.el7.x86_64.rpm rpm -Uvh rpm-4.11.3-32.el7.x86_64.rpm --nodeps
成功!
注意:升級成了python3
也能夠用python2
,
由於yum使用python2
,所以替換爲python3後可能沒法正常工做,繼續使用這個python2.7
. 所以修改yum配置文件node
sudo vim /usr/bin/yum
python
把文件頭部的#!/usr/bin/python改爲#!/usr/bin/python2.7保存退出便可.web
/usr/libexec/urlgrabber-ext-down
看看,發下他也使用了/usr/bin/python
,因而跟前面同樣,改成2.7,完成。
轉載請說明出處,謝謝!本文地址:http://www.javashuo.com/article/p-vhcppiol-bd.htmlshell