CentOS 7.8配置本地yum源时发现python没了

1970阅读 0评论2021-09-01 东方蜘蛛
分类:LINUX

在给客户配置一台CentOS 7.8系统的本地yum源后,执行
# yum clean all && yum makecache
# yum list

均报错:
-bash: /usr/bin/yum: /usr/bin/python: bad interpreter: No such file or directory

赶紧whereis python,没有路径,rpm -qa| grep python也没有输出,怀疑客户自己删掉了python。

进入相同版本的iso挂载pkg目录,执行rpm -ivh *python*提示报错,无法正常安装,有很多依赖关系。

只能选择忽略依赖安装,执行:
# rpm -ivh  *python* --nodeps
顺利安装了相关python包,再执行yum list看看,结果又报错了:
# yum list
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 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.7.5 (default, Apr  2 2020, 13:16:51) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]

If you cannot solve this problem yourself, please go to 
the yum faq at:
 

从报错中可以看出是python版本和yum不兼容,感觉没道理呀,相同的源怎么会这样?
只好重新安装yum试试:
# rpm -Uvh --replacepkgs *yum* --nodeps
再次执行yum list可以看到本地yum源,测试下软件包的安装:
# yum -y install ntp
也能顺利安装。


上一篇:ORAchk-数据库健康检查好帮手
下一篇:Solaris系统无法引导需要更新boot_archive两种情况