yum无法使用 : module doesn‘t match the current version of Python

问题描述:

使用conda安装了新版本的Python3.8,并且把对应的动态函数库加入了ld.so.cache中(这是系统在软件运行时,用来搜索动态链接库的目录文件,具体见ldconfig的作用 & 编译时动态的链接问题 )。
但是系统自带的是python2.7,并且使用python2.7构建的yum。当调用yum的时候,yum希望搜索到python2.7的动态链接库,但是因为python3.8的函数库是后加进去的,所以先被yum搜索到,因此报出了如下动态链接库版本不兼容的问题。

There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

 /home/Js/ENTER/lib/liblzma.so.5: version `XZ_5.1.2alpha' not found (required by /lib64/librpmio.so.3)

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:
http://yum.baseurl.org/wiki/Faq

解决办法

1.更新yum,使用conda的python3.8编译。(有点麻烦,现在时间不够,放弃)
2.删除现有的/etc/ld.so.cache,删除/etc/ld.so.conf文件内conda的函数库目录,运行ldconfig命令重新生成/etc/ld.so.cache(需要root权限,这些操作的解释可以参照ldconfig的作用 & 编译时动态的链接问题)。

sudo rm /etc/ld.so.cache
vim /etc/ld.so.conf #进去删除包含conda 函数库目录的那一行
sudo ldconfig

解决。
ps: 就是以后需要使用conda的动态链接库时候,需要使用如下命令指定。

export LD_LIBRARY_PATH=/conda/lib/directory/

意外收获

知道了centos的一个工具alternatives,是用来管理多个版本的软件的工具。


参考

  1. 系统中更换默认的python 版本 How to change from default to alternative Python version on Debian Linux
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值