您的位置:首页 > 财经 > 产业 > yum使用报错:ImportError: /lib64/libxml2.so.2: file too short

yum使用报错:ImportError: /lib64/libxml2.so.2: file too short

2024/12/23 16:13:41 来源:https://blog.csdn.net/u012972390/article/details/140192241  浏览:    关键词:yum使用报错:ImportError: /lib64/libxml2.so.2: file too short

系统版本:Rocky 8.10
报错信息:

Traceback (most recent call last):File "/usr/lib64/python3.6/site-packages/libdnf/error.py", line 14, in swig_import_helperreturn importlib.import_module(mname)File "/usr/lib64/python3.6/importlib/__init__.py", line 126, in import_modulereturn _bootstrap._gcd_import(name[level:], package, level)File "<frozen importlib._bootstrap>", line 994, in _gcd_importFile "<frozen importlib._bootstrap>", line 971, in _find_and_loadFile "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlockedFile "<frozen importlib._bootstrap>", line 658, in _load_unlockedFile "<frozen importlib._bootstrap>", line 571, in module_from_specFile "<frozen importlib._bootstrap_external>", line 922, in create_moduleFile "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
ImportError: /lib64/libxml2.so.2: file too shortDuring handling of the above exception, another exception occurred:Traceback (most recent call last):File "/usr/bin/yum", line 61, in <module>from dnf.cli import mainFile "/usr/lib/python3.6/site-packages/dnf/__init__.py", line 30, in <module>import dnf.baseFile "/usr/lib/python3.6/site-packages/dnf/base.py", line 29, in <module>import libdnf.transactionFile "/usr/lib64/python3.6/site-packages/libdnf/__init__.py", line 8, in <module>from . import errorFile "/usr/lib64/python3.6/site-packages/libdnf/error.py", line 17, in <module>_error = swig_import_helper()File "/usr/lib64/python3.6/site-packages/libdnf/error.py", line 16, in swig_import_helperreturn importlib.import_module('_error')File "/usr/lib64/python3.6/importlib/__init__.py", line 126, in import_modulereturn _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named '_error'

解决方法:重新安装libxml2

下载libxml2安装包对应的rpm安装包:libxml2-2.9.7-18.el8.x86_64

卸载原本安装包
rpm -e --nodeps libxml2-2.9.7-18.el8.x86_64
重新安装
rpm -ivh libxml2-2.9.7-18.el8_10.1.x86_64.rpm
检查yum是否正常
yum repolist

故障原因

应该是有多个libxml2安装了,导致冲突。卸载重装即可。

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com