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

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

yum remove yum

然后就杯具了...

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

 

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

1  rpm -ivh  --nodeps http://mirrors.163.com/centos/5/os/x86_64/CentOS/yum-fastestmirror-1.1.16-14.el5.centos.1.noarch.rpm
2 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
3 rpm -ivh --nodeps http://mirrors.163.com/centos/5/os/x86_64/CentOS/yum-3.2.22-26.el5.centos.noarch.rpm

关于rpm --nodeps的解释

1 --nodeps                         don't verify package dependencies 

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

 1  [root@localhost ~]# yum
2 There was a problem importing one of the Python modules
3 required to run yum. The error leading to this problem was:
4
5 libxml2.so.2: cannot open shared object file: No such file or directory
6
7 Please install a package which provides this module, or
8 verify that the module is installed correctly.
9
10 It's possible that the above module doesn't match the
11 current version of Python, which is:
12 2.4.3 (#1, Nov 11 2010, 13:30:19)
13 [GCC 4.1.2 20080704 (Red Hat 4.1.2-48)]
14
15 If you cannot solve this problem yourself, please go to
16 the yum faq at:
17 http://wiki.linux.duke.edu/YumFaq

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

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

 

 

 

提示缺少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命令,结果正常了,大喜

 

 1 [root@localhost ~]# yum
2 Loaded plugins: fastestmirror
3 You need to give some command
4 usage: yum [options] COMMAND
5
6 List of Commands:
7
8 check-update Check for available package updates
9 clean Remove cached data
10 deplist List a package's dependencies
11 downgrade downgrade a package
12 erase Remove a package or packages from your system
13 groupinfo Display details about a package group
14 groupinstall Install the packages in a group on your system
15 grouplist List available package groups
16 groupremove Remove the packages in a group from your system
17 help Display a helpful usage message
18 info Display details about a package or group of packages
19 install Install a package or packages on your system
20 list List a package or groups of packages
21 localinstall Install a local RPM
22 makecache Generate the metadata cache
23 provides Find what package provides the given value
24 reinstall reinstall a package
25 repolist Display the configured software repositories
26 resolvedep Determine which package provides the given dependency
27 search Search package details for the given string
28 shell Run an interactive yum shell
29 update Update a package or packages on your system
30 upgrade Update packages taking obsoletes into account
31
32
33 options:
34 -h, --help show this help message and exit
35 -t, --tolerant be tolerant of errors
36 -C run entirely from cache, don't update cache
37 -c [config file] config file location
38 -R [minutes] maximum command wait time
39 -d [debug level] debugging output level
40 --showduplicates show duplicates, in repos, in list/search commands
41 -e [error level] error output level
42 -q, --quiet quiet operation
43 -v, --verbose verbose operation
44 -y answer yes for all questions
45 --version show Yum version and exit
46 --installroot=[path] set install root
47 --enablerepo=[repo] enable one or more repositories (wildcards allowed)
48 --disablerepo=[repo] disable one or more repositories (wildcards allowed)
49 -x [package], --exclude=[package]
50 exclude package(s) by name or glob
51 --disableexcludes=[repo]
52 disable exclude from main, for a repo or for
53 everything
54 --obsoletes enable obsoletes processing during updates
55 --noplugins disable Yum plugins
56 --nogpgcheck disable gpg signature checking
57 --disableplugin=[plugin]
58 disable plugins by name
59 --enableplugin=[plugin]
60 enable plugins by name
61 --skip-broken skip packages with depsolving problems
62 --color=COLOR control whether color is used
63
64 Plugin Options:

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

1 yum update

好了 这样yum问题就完全解决了!

linux输入yum后提示: -bash: /usr/bin/yum: No such file or directory的解决方案的更多相关文章

  1. bash: /usr/bin/npm: No such file or directory

    一个整得很烂了的Ubuntu服务器, 各种问题乱出. npm老是升不到最新版(一直显示1.4),于是我干脆删了, 结果再去装却装不上了, 如果用apt-get install npm安装, 就得到如下 ...

  2. xmanager运行报错:bash: /usr/bin/xterm: No such file or directory

    1.原因 xterm没有安装,解决办法是下载然后安装即可. 如果机器可以用yum,则直接使用yum安装xterm即可: yum install -y xterm 如果没有网络,则在某台操作系统大版本相 ...

  3. git 源码安装后报错/usr/bin/git: No such file or directory

    现象 今天源码安装一个git后,执行git命令后报如下错误: $ git --version -bash: /usr/bin/git: No such file or directory 分析过程 开 ...

  4. -bash: /usr/bin/yum: /usr/bin/python: bad interpreter: No such file or directory

    -bash: /usr/bin/yum: /usr/bin/python: bad interpreter: No such file or directory python多版本造成额问题 找不到p ...

  5. java配置好jdk-bash: /usr/bin/java: No such file or directory

    在 Linux 系统中安装 JDK 环境,配置好环境变量后,输入 java.javac 或者 java -version 等时,都提示如下错误: -bash: /usr/local/java/bin/ ...

  6. zsh: /usr/local/bin/pod: bad interpreter: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby: no such file or directory

    系统升级为 macOS Catalina 发现 CocoaPods 不管用了. 解决方法: 打开 iTerm2 sudo gem update --system 输入电脑密码,然后 sudo gem ...

  7. -bash: /usr/librxec/grepconf.sh:Nosuch file or directory

    最近修改/etc/profile文件时,不小心在后面添加了source /etc/profile,导致使用xshell登录远程linux的时候出现下面的信息, 一直无法进入linux,将profile ...

  8. python升级3.6后 yum出错File "/usr/bin/yum", line 30 ^

    问题描述: # yum provides ifconfig File "/usr/bin/yum", line 30 except KeyboardInterrupt, e: ^ ...

  9. 记录将CentOS7linux系统python升级到3后yum安装是报错File "/usr/bin/yum", line 30 except KeyboardInterrupt, e: ^ SyntaxError: invalid syntax问题解决

    前两天将CentOS7里的python版本升级到了3.5.2 今天想装个解压软件,在执行yum install -y XXX 的时候报错 然后按照提示打开这个文件 vi /usr/bin/yum yu ...

随机推荐

  1. linux 文件三大特殊权限(SUID SGID SBIT)

    SGID(这个应该是文件共享里面最常用权限管理手段) 作用于目录或可执行程序,作用于目录代表在此目录创建的文件或目录,默认的属组继承此目录的属组.例如 我这个testgroup 没有设置SGID .我 ...

  2. 【MVC】使用笔记

    1,在ASP.NET MVC中,路由机制特别碉堡,直接对应于动作方法.没有必要给每一个动作方法添加视图,当视图返回View时,路由系统会自动寻找指定目录下的视图资源. public ViewResul ...

  3. hdu 4801模拟题

    /* 模拟: 注意:实质上一次魔方的一半要变化 用c++超内存 用g++过了 */ #include<stdio.h> #include<string.h> #include& ...

  4. bzoj5090组题 分数规划

    组题 Time Limit: 1 Sec  Memory Limit: 256 MBSubmit: 542  Solved: 114[Submit][Status][Discuss] Descript ...

  5. SQL SERVER 2012 第四章 连接 JOIN の INNER JOIN

    所有JOIN语句的共同点是:将一个记录与另外一个或多个记录匹配,从而生成一个新记录,这个记录是由两个记录的合并列所产生的一个超集. 内部连接: 内部连接语法结构:SELECT <select l ...

  6. 一个开发的Linux使用心得总结

    Liunx介绍 Linux是一套免费使用和自由传播的类Unix操作系统,是一个基于POSIX和UNIX的多用户.多任务.支持多线程和多CPU的操作系统.它能运行主要的UNIX工具软件.应用程序和网络协 ...

  7. 洛谷——P1047 校门外的树

    P1047 校门外的树 题目描述 某校大门外长度为L的马路上有一排树,每两棵相邻的树之间的间隔都是1米.我们可以把马路看成一个数轴,马路的一端在数轴0的位置,另一端在L的位置:数轴上的每个整数点,即0 ...

  8. POJ 3281 [网络流dinic算法模板]

    题意: 农场主有f种食物,d种饮料,n头牛. 接下来的n行每行第一个数代表第i头牛喜欢吃的食物数量,和第i头牛喜欢喝的饮料数目. 接下来分别是喜欢的食物和饮料的编号. 求解:农场主最多能保证几头牛同时 ...

  9. eclipse导入maven工程步骤

    转自:http://jingyan.baidu.com/article/cbf0e500a6e3252eaa2893c1.html 感谢作者 步骤一 : 选择 “Import”操作 有两个途径可以选择 ...

  10. 百亿级企业级 RPC 框架开源了!

    今天给大家介绍给一款性能卓越的 RPC 开源框架,其作者就是我推荐每个 Java 程序员都应该看的<Java 生态核心知识点整理>的原作者张玉龙. 说实话我第一次看到这个资料的时候,就感觉 ...