当前位置首页 > Fedora知识

fedorayum无法正常运行问题的解决

阅读次数:267 次  来源:admin  发布时间:

之前因为在fedora下的一些误操作(因为重新编译安装了python),导致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 rpm

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:

google了一下,在 http://forums.fedoraforum.org/showthread.php?t=167992 以及 http://deadlockprocess.wordpress.com/2010/07/18/how-to-reinstall-rpm-and-yum-without-rpm-and-yum-in-centosrhel/ 找到了一些参考方案,但是按上面的方法重新安装包都没能修复这个问题。既然是因为修改了python的原因造成,那就重新安装下python的依赖吧。

因为yum用不了了,所以只能重新通过手动下载rpm包的方式进行安装了。在http://rpmfind.net/ 上下了对应版本的python.rpm包,发现此包还依赖于python-libs.rpm,同样下载下来进行安装。

rpm -ivh python-libs-xxx.x86_64.rpm --force
rpm -ivh python.xxxx.rpm --force

因为下载下来的版本可能会比已经安装的版本旧,所以会报一些文件冲突,版本过旧等问题,所以利用--force参数强制安装。安装好了发现yum可以使用了.....好吧,这样都可以......

顺便介绍一下rpm包管理的简单操作:

rpm -ivh xxxx.rpm    #安装
rpm -Uvh xxxx.rpm    #更新
rpm -e   xxxx        #删除    通过--nodeps可以忽略依赖限制

rpm -q   xxxx         #查看以安装的包的信息
rpm -qp  xxxx.rpm     #查看rpm包的信息,可以加 -l 参数显示内容

rpm2cpio  xxxx.rpm  | cpio  -dium     #解压rpm包

相比rpm和yum还是比较习惯dpkg和aptitude,嗯,多用用就习惯了~

Over~

上一篇:Centos7安装MySQL详细步骤
下一篇:在centos下安装和使用MySQL