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重新安装成功

原文地址:https://blog.51cto.com/13555423/2476202

时间: 2024-11-05 22:54:06

yum报错-bash: /usr/bin/yum: /usr/bin/python2.7: bad的相关文章

CentOS中输入yum报错:sudo: unable to execute /bin/yum: No such file or directory

今天尝试更新了下虚拟机CentOS中的python版本后. 运行“yum”命令,就报错:“sudo: unable to execute /bin/yum: No such file or directory” 查询了下网上的资料发现,原来yum调用是用python写的.遂想起刚刚更新python版本,忘了修改yum配置文件了. 解决办法:修改yum配置文件  [[email protected] ~]#vim /usr/bin/yum 把文件头部的#!/usr/bin/python改成#!/u

升级Python导致yum报错

一天,需要在Linux服务器上面安装一个rpm包,结果运行yum命令的时候无论如何都会报错,如下: [[email protected] bin]# yum There was a problem importing one of the Python modules required to run yum. The error leading to this problem was:    No module named yum Please install a package which p

Centos7.0安装python2.7后yum报错

yum报错: vi /usr/libexec/urlgrabber-ext-down 把头部的Python改成和/usr/bin/yum中一样的

yum报错的问题

可能是因为重复安装了curl .7.45 ,导致yum报错: /usr/lib64/python2.6/site-packages/pycurl.so: undefined symbol: CRYPTO_set_locking_callback 网上看到是动态库冲突,按网上说的如下操作: [[email protected] ~]# ldd /usr/lib64/python2.6/site-packages/pycurl.so linux-vdso.so.1 => (0x00007fff677

rhel yum报错

用yum报错 http://mirrors.aliyun.com/centos/%24releasever/addons/x86_64/repodata/repomd.xml: [Errno 12] Timeout: <urlopen error timed out> Trying other mirror. http://mirrors.aliyuncs.com/centos/%24releasever/addons/x86_64/repodata/repomd.xml: [Errno 14

搭建仓库,yum报错无签署问题

在centos系统中使用yum报错 yum install xxx.rpm warning: Package xxx.rpm is not signed google一下,解决方法都是 1.修改yum.conf 路径:/etc/yum.conf 找到 gpgcheck=1 将其修改为0:gpgcheck=0 2.修改/etc/yum.repos.d /utterramblings.repo 找到 gpgcheck=1 将其修改为0:gpgcheck=0 如果不行 只要在在后面加上--nogpgc

yum报错setup has installed conflicts filesystem &lt; (&#39;0&#39;, &#39;3&#39;, None): filesystem

yum安装出现以下错误: Error: Depsolving loop limit reached. Error: Package: cloog-ppl-0.15.7-1.2.el6.x86_64 (@anaconda-CentOS-201508042137.x86_64/6.7) Requires: libgmp.so.3()(64bit) Removing: gmp-4.3.1-7.el6_2.2.x86_64 (@anaconda-CentOS-201508042137.x86_64/6.

解决yum报错:UnicodeDecodeError: &#39;ascii&#39; codec can&#39;t decode ... ordinal not in range

在使用yum部署环境的时候,出现了报错: UnicodeDecodeError: 'ascii' codec can't decode ... ordinal not in range 解决办法: [[email protected] ~]# ll /var/lib/rpm/*db*-rw-r--r-- 1 root root 73728 Aug 15 14:52 /var/lib/rpm/__db.001-rw-r--r-- 1 root root 270336 Aug 15 14:52 /v

[Q&A]yum报错‘database disk image is malformed’

错误描述: 在yum安装软件的过程中使用 Ctrl + c 组合键取消安装,之后再使用yum时报错: Error: database disk image is malformed 例如: [[email protected] etc]$ yum repolist Loaded plugins: fastestmirror, security Loading mirror speeds from cached hostfile * base: mirrors.yun-idc.com * extr