无法使用任何 yum 命令“全局名称‘IncrementalDecoder’未定义”

无法使用任何 yum 命令“全局名称‘IncrementalDecoder’未定义”

在我的 CentOS 6.9 64 位系统上,每次我写入任何相关的 yum 命令时,答案都是:

Traceback (most recent call last):
  File "/usr/bin/yum", line 29, in <module>
    yummain.user_main(sys.argv[1:], exit_code=True)
  File "/usr/share/yum-cli/yummain.py", line 298, in user_main
    errcode = main(args)
  File "/usr/share/yum-cli/yummain.py", line 115, in main
    base.getOptionsConfig(args)
  File "/usr/share/yum-cli/cli.py", line 229, in getOptionsConfig
    self.conf
  File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 911, in <lambda>
    conf = property(fget=lambda self: self._getConfig(),
  File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 335, in _getConfig
    startupconf.pluginconfpath,disabled_plugins,enabled_plugins)
  File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 564, in doPluginSetup
    plugin_types, confpath, disabled_plugins, enabled_plugins)
  File "/usr/lib/python2.6/site-packages/yum/plugins.py", line 159, in __init__
    self._importplugins(types)
  File "/usr/lib/python2.6/site-packages/yum/plugins.py", line 211, in _importplugins
    nxt = ' ' * (utf8_width(key) - 2) + ': '
  File "/usr/lib/python2.6/site-packages/yum/i18n.py", line 218, in utf8_width
    for (ucs, bytes) in __utf8_iter_ucs(msg):
  File "/usr/lib/python2.6/site-packages/yum/i18n.py", line 174, in __utf8_iter_ucs
    for byte0 in uiter:
  File "/usr/lib/python2.6/site-packages/yum/i18n.py", line 170, in __utf8_iter_ints
    for byte in to_utf8(msg):
  File "/usr/lib/python2.6/site-packages/yum/i18n.py", line 436, in to_utf8
    obj = obj.encode('utf-8', errors)
  File "/usr/lib64/python2.6/encodings/__init__.py", line 120, in search_function
    entry = getregentry()
  File "/usr/lib64/python2.6/encodings/utf_8.py", line 39, in getregentry
    incrementaldecoder=IncrementalDecoder,
NameError: global name 'IncrementalDecoder' is not defined

yum clean all 并删除并重新安装 yum 无法解决问题。

有什么提示吗?

问候

答案1

有些人遇到了类似的问题,并且与 Python 有关。

尝试安装 python-2.6.6-66.el6_8.x86_64.rpm 并输入hash -r python

参考 :

答案2

安装http://mir01.syntis.net/CentOS/6.9/os/x86_64/Packages/python-libs-2.6.6-66.el6_8.x86_64.rpm

解决我的问题:

rpm -iv --replacepkgs python-libs-2.6.6-66.el6_8.x86_64.rpm

謝謝…

相关内容