yum报错-bash: /usr/bin/yum: /usr/bin/python2.7: bad

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了yum报错-bash: /usr/bin/yum: /usr/bin/python2.7: bad相关的知识,希望对你有一定的参考价值。

1.创建目录python和yum用以存放rpm包:

mkdir /usr/local/src/python
mkdir /usr/local/src/yum

2.使用wget分别下载python以及yum的rpm包(注意:一定要和系统的版本号对应)地址:http://vault.centos.org

(1)下载python的rpm包:

 cd /usr/local/src/python 
wget http://vault.centos.org/7.2.1511/os/x86_64/Packages/python-2.7.5-34.el7.x86_64.rpm
wget http://vault.centos.org/7.2.1511/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm
wget http://vault.centos.org/7.2.1511/os/x86_64/Packages/python-pycurl-7.19.0-17.el7.x86_64.rpm
wget http://vault.centos.org/7.2.1511/os/x86_64/Packages/python-devel-2.7.5-34.el7.x86_64.rpm
wget http://vault.centos.org/7.2.1511/os/x86_64/Packages/python-libs-2.7.5-34.el7.x86_64.rpm
wget http://vault.centos.org/7.2.1511/os/x86_64/Packages/python-urlgrabber-3.10-7.el7.noarch.rpm
wget http://vault.centos.org/7.2.1511/os/x86_64/Packages/rpm-python-4.11.3-17.el7.x86_64.rpm

?(2)下载yum的rpm包:

cd /usr/local/src/yum
wget http://vault.centos.org/7.2.1511/os/x86_64/Packages/yum-3.4.3-132.el7.centos.0.1.noarch.rpm
wget http://vault.centos.org/7.2.1511/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget http://vault.centos.org/7.2.1511/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm

3.安装python以及yum的rpm包

(1)安装python:

rpm -ivh python-*   rpm-python-* --nodeps --force
--nodeps --force     为不考虑依赖包,强制安装。

??(2)安装yum:

cd /usr/local/src/yum
rpm -ivh yum-*

yum重新安装成功

以上是关于yum报错-bash: /usr/bin/yum: /usr/bin/python2.7: bad的主要内容,如果未能解决你的问题,请参考以下文章

linux输入yum后提示: -bash: /usr/bin/yum: No such file or directory的解决方案

使用yum命令报错File "/usr/bin/yum", line 30 except KeyboardInterrupt, e: SyntaxError: invalid

如何解决python升级后yum报错

Linux 执行yum clean all报错File "/usr/bin/yum", line 30 except KeyboardInterrupt,

yum 安装报错 File "/usr/bin/yum", line 30 except KeyboardInterrupt, e:

在centos7中安装python时,输入yum出现 -bash: /usr/bin/yum: No such file or directory