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

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

今天在安装程序时,发现有一个插件未安装,我就随手敲了一个命令,看都没看

yum remove yum

然后就杯具了...

[root@localhost ~]# yum
-bash: /usr/bin/yum: No such file or directory 

这个粗心的手误倒不至于让整个系统瘫痪,yum 却无法使用了。于是,我试着折腾了一番

rpm -ivh --nodeps http://mirrors.163.com/centos/5/os/x86_64/CentOS/yum-fastestmirror-1.1.16-14.el5.centos.1.noarch.rpm
rpm -ivh --nodeps http://mirrors.163.com/centos/5/os/x86_64/CentOS/yum-metadata-parser-1.1.2-3.el5.centos.x86_64.rpm
rpm -ivh --nodeps http://mirrors.163.com/centos/5/os/x86_64/CentOS/yum-3.2.22-26.el5.centos.noarch.rpm

关于rpm --nodeps的解释

--nodeps             don't verify package dependencies 

接下来,再次尝试输入yum,结果再次出现莫名错误

[root@localhost ~]# yum
 There was a problem importing one of the Python modules
 required to run yum. The error leading to this problem was: 

 libxml2.so.2: cannot open shared object file: No such file or directory 

 Please install a package which provides this module, or
 verify that the module is installed correctly. 

 It's possible that the above module doesn't match the
 current version of Python, which is:
 2.4.3 (#1, Nov 11 2010, 13:30:19)
 [GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] 

 If you cannot solve this problem yourself, please go to
 the yum faq at:
 http://wiki.linux.duke.edu/YumFaq

因为yum调用的是python,运行 Python,试下是否可行

[root@localhost~]# python
 Python 2.4.3 (#1, Nov 11 2010, 13:30:19)
 [GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux2
 Type "help", "copyright", "credits" or "license" for more information.
 >>> import yum
 Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.4/site-packages/yum/__init__.py", line 54, in ?
   import transactioninfo
  File "/usr/lib/python2.4/site-packages/yum/transactioninfo.py", line 31, in ?
   from sqlitesack import YumAvailablePackageSqlite
  File "/usr/lib/python2.4/site-packages/yum/sqlitesack.py", line 26, in ?
   import yumRepo
  File "/usr/lib/python2.4/site-packages/yum/yumRepo.py", line 32, in ?
   import sqlitecachec
  File "/usr/lib64/python2.4/site-packages/sqlitecachec.py", line 19, in ?
   import _sqlitecache
 ImportError: libxml2.so.2: cannot open shared object file: No such file or directory
 >>>

提示缺少libxml2.so.2,安装一下试试

rpm -ivh http://mirrors.163.com/centos/5/os/x86_64/CentOS/libxml2-2.6.26-2.1.2.8.x86_64.rpm

再次测试运行下yum命令,结果正常了,大喜

[root@localhost ~]# yum
 Loaded plugins: fastestmirror
 You need to give some command
 usage: yum [options] COMMAND 

 List of Commands: 

 check-update  Check for available package updates
 clean     Remove cached data
 deplist    List a package's dependencies
 downgrade   downgrade a package
 erase     Remove a package or packages from your system
 groupinfo   Display details about a package group
 groupinstall  Install the packages in a group on your system
 grouplist   List available package groups
 groupremove  Remove the packages in a group from your system
 help      Display a helpful usage message
 info      Display details about a package or group of packages
 install    Install a package or packages on your system
 list      List a package or groups of packages
 localinstall  Install a local RPM
 makecache   Generate the metadata cache
 provides    Find what package provides the given value
 reinstall   reinstall a package
 repolist    Display the configured software repositories
 resolvedep   Determine which package provides the given dependency
 search     Search package details for the given string
 shell     Run an interactive yum shell
 update     Update a package or packages on your system
 upgrade    Update packages taking obsoletes into account 

 options:
  -h, --help      show this help message and exit
  -t, --tolerant    be tolerant of errors
  -C          run entirely from cache, don't update cache
  -c [config file]   config file location
  -R [minutes]     maximum command wait time
  -d [debug level]   debugging output level
  --showduplicates   show duplicates, in repos, in list/search commands
  -e [error level]   error output level
  -q, --quiet      quiet operation
  -v, --verbose     verbose operation
  -y          answer yes for all questions
  --version       show Yum version and exit
  --installroot=[path] set install root
  --enablerepo=[repo]  enable one or more repositories (wildcards allowed)
  --disablerepo=[repo] disable one or more repositories (wildcards allowed)
  -x [package], --exclude=[package]
             exclude package(s) by name or glob
  --disableexcludes=[repo]
             disable exclude from main, for a repo or for
             everything
  --obsoletes      enable obsoletes processing during updates
  --noplugins      disable Yum plugins
  --nogpgcheck     disable gpg signature checking
  --disableplugin=[plugin]
             disable plugins by name
  --enableplugin=[plugin]
             enable plugins by name
  --skip-broken     skip packages with depsolving problems
  --color=COLOR     control whether color is used 

  Plugin Options:

最后,赶紧更新一下系统吧

yum update

好了 这样yum问题就完全解决了!大家可以尝试下,感谢你对我们的支持。

(0)

相关推荐

  • Linux yum软件包管理方法

    简介 yum( Yellow dog Updater, Modified)是一个在Fedora和RedHat以及SUSE中的Shell前端软件包管理器.基于RPM包管理,能够从指定的服务器自动下载RPM包并且安装,可以自动处理依赖性关系,并且一次安装所有依赖的软体包,无须繁琐地一次次下载.安装.yum提供了查找.安装.删除某一个.一组甚至全部软件包的命令,而且命令简洁而又好记. yum命令 语法 yum [选项] [要进行的操作] [软件包名称--] 命令选项: -h:帮助 -y:当安装过程提示

  • linux常用命令小结之yum、源码安装

    一.软件安装 rpm rpm -ivh zziplib-0.13.62-5.el7.x86_64.rpm   //安装zziplib-0.13.62-5.el7.x86_64.rpm rpm  -qf `which cd`      //查看cd的包名,这里使用反引号,rpm会取反引号中命令的结果作为参数, rpm包格式,包名.版本号.发布版本号.平台 rpm -ivh rpm包文件 //安装 rpm -Uvh rpm包文件 //升级 rpm -e 包名 //卸载 rpm -qa //查询安装的

  • linux服务器上安装jdk的两种方法(yum+下载包)

    前言 对于开发者来说,安装jdk按理说是非常简单的事,但在linux下安装着实费了我这个一直玩windows的小白不少劲.这里简单把步骤梳理下,希望能帮助像我这样的纯小白人士少踩点坑. 这里介绍两种安装方式: 1.yum安装: 2.从官网下载包安装 一.获得一台linux服务器 要在linux下安装jdk,首先你得先有一台linux服务器,作为小白,手头的机器肯定都是windows的,搞个虚拟机安装对我这种小白简直是折磨人:这里使用最简单的方式获得一台linux服务器,就是从阿里云上租一台.镜像

  • linux yum安装指定版本mysql的教程详解

    1.下载mysql rpm包 cd /usr/local/src wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm 2.安装下载的rpm包 yum localinstall mysql80-community-release-el7-3.noarch.rpm 或 sudo rpm -Uvh mysql80-community-release-el6-n.noarch.rpm 3.查看yum存储库中的

  • Linux yum 命令安装mysql8.0的教程详解

    一 ,做好安装前的清理工作 rpm -pa | grep mysql 或者 rpm -qa | grep -i mysql yum remove mysql-xxx-xxx find / -name mysql rm -rf /xxx/xxx/xxx 二 , 下载对应的安装包 下载链接:https://dev.mysql.com/downloads/repo/yum/  三 , 安装mysql 执行rpm文件 rpm -ivh mysql57-community-release-el7-11.n

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

    linux输入yum后提示: -bash: /usr/bin/yum: No such file or directory的解决方案 今天在安装程序时,发现有一个插件未安装,我就随手敲了一个命令,看都没看 yum remove yum 然后就杯具了... [root@localhost ~]# yum -bash: /usr/bin/yum: No such file or directory 这个粗心的手误倒不至于让整个系统瘫痪,yum 却无法使用了.于是,我试着折腾了一番 rpm -ivh

  • 64位linux 编译c提示gnu/stubs-32.h:No such file or directory的解决方法

    64位linux提示gnu/stubs-32.h:No such file or directory的解决方法 这个问题是由于缺少32位兼容包,解决办法: ubuntu: sudo apt-get install libc6-dev-i386 CentOS:yum -y install glibc-devel.i686 Re阿里云yum源没有glibc.i686 阿里云的64位Linux发行版屏蔽了32位,也就是常见的i686软件包的数据源,你可以修改yum的配置文件/etc/yum.conf,

  • Linux执行可执行文件提示No such file or directory的解决方法

    最近在使用Linux操作系统执行一个可执行文件,结果出现了No such file or directory的提示,表示很疑惑. ./tshrf bash: ./tshref: No such file or directory 查看文件信息,可以看到文件是存在的,并且是可以执行的. -rwxr-xr-x 1 yuan yuan 20581 4月 29 2004 tshref 查阅资料后,原因是系统位数与该可执行文件需要的lib库位数不匹配. 用uname命令打印系统信息,发现系统是64位系统

  • Laravel执行migrate命令提示:No such file or directory的解决方法

    本文实例讲述了Laravel执行migrate命令提示:No such file or directory的解决方法.分享给大家供大家参考,具体如下: 今天使用Laravel命令行工具操作数据库迁移操作时报错,提示mysql 2002错误,如图: 查看数据库配置没错呀,网站前台也可以打开,说明能连上,那是什么原因呢? 在Laravel5中,有两种办法解决: 1.增加一个数据库配置项 'mysql' => [ 'driver' => 'mysql', 'host' => env('DB_H

  • python错误提示:Errno 2] No such file or directory的解决方法

    目录 1.问题描述: 2.解决方法: 3.小结: 总结 1.问题描述: 在学习北京大学曹健老师的tensorflow2.0笔记的时候,遇到了 [Errno 2] No such file or directory: './mnist_image_label/mnist_train_jpg_60000.txt' 这个没有查找到子文件或者子文件夹的问题. 2.解决方法: 首先,确定所写的路径中包含相应的文件夹或者文件. 其次,如果文件名字或者路径没写错,查看自己是否使用相对路径(绝对路径一般不会报错

  • bash: /usr/bin/autocrorder: /usr/bin/python^M: bad interpreter: No such file or directory

    在windows系统下写的python脚本,在linux下赋予权限chmod +x xxx.py 以后,执行./xxx.py运行提示:bash: /usr/bin/autocrorder: /usr/bin/python^M: bad interpreter: No such file or directory 分析: 这是不同系统编码格式引起的:在windows系统中编辑的.sh .py文件可能有不可见字符,所以在Linux系统下执行会报以上异常信息.一般是因为windows行结尾和linux

  • Android应用第一次安装成功点击“打开”后Home键切出应用后再点击桌面图标返回导致应用重启问题的解决方法

    if((getIntent().getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != 0){ finish(); return; } 应用程序入口Activity的onCreate方法中加入上面的判断,完美解决应用程序多次重启问题. 应用程序入口Activity的onCreate方法中加入上面的判断,在setcontentview方法之前调用. 以上所述是小编给大家介绍的 Android应用第一次安装成功点击"打开"后Ho

  • 故障的机器修好后重启,狂拉主库binlog,导致网络问题的解决方法

    问题简述: 一周前,有一台mysql服务器发生硬件故障,停机了.我们给专门负责这块的同学提交了申请,他们负责去报修这台服务器.今天这台服务器修好后,他们将其开机启动.服务器上的4个mysql实例在开机后自动启动,开始拉主库的binlog.由于这台服务器停机时间比较久,日志丢的比较多,狂拉主库的binlog,导致主库网络出现问题. 现象: 首先,我们完全没有意识到是因为一台坏掉的服务器重启拉主库binlog导致的,因为我们压根不知道 这台服务器什么情况,只知道1周前,我们报修了1台服务器.具体什么

  • 安装MSDE2000提示为了安全起见,要求使用强 SA 密码的解决方法

    今天下载了一个msde2000A,本想按照平时的安装习惯,找到了setup.exe安装程序,错误提示弹出一个对话框:"为了安全起见,要求使用强 SA 密码.请使用SAPWD开关提供同一密码.有关详细信息,请参阅自述文件.安装程序将立即退出."郁闷.看文档还不如百度下,找到了几种解决方案: 1.命令提示符下进入安装目录.比如MSDERelA.然后键入setup.exe SAPWD="YOUR COMPUTER PASSWORD".安装成功了.如图示: 这样很快就安装好

  • 仅img元素创建后不添加到文档中会执行onload事件的解决方法

    示例 复制代码 代码如下: <!DOCTYPE HTML> <HTML> <HEAD> <meta charset="utf-8" /> <title>仅img元素创建后却不添加到文档中会执行onload事件</title> </HEAD> <BODY> <script> var img = document.createElement('img'); img.src = &qu

随机推荐