使用Python 2.6/2.7的Yum“cannot import name Errors”Red Hat 4.4

2024-04-20 05:29:20 发布

您现在位置:Python中文网/ 问答频道 /正文

我尝试运行的任何yum命令都将返回以下结果:

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

   cannot import name Errors

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.6.6 (r266:84292, Aug 18 2016, 15:13:37)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-17)]

If you cannot solve this problem yourself, please go to
the yum faq at:
  http://yum.baseurl.org/wiki/Faq

这就是我所做的和我所知道的:

操作系统是Red hat 4.4.7018

我相信Python是2.6版本,不久前更新到2.7版本(我怀疑这可能破坏了yum)

python -V返回2.7.13

^{pr2}$

我尝试过在所有phytons上运行import yum,但是只有2.6没有给我错误,所以我尝试将链接改回2.6(用python -V验证以检查它是否回到2.6.6版本),yum仍然返回“cannot import name Errors”错误。在

另外,PATH变量:

# echo $PATH

    /usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/git/bin:/root/bin

/usr/bin/yum上配置的python是#!/usr/bin/python2.6,我尝试过将其更改为/python,甚至是{},但仍然得到错误。在


Tags: thetoimport版本binusrlocal错误
2条回答

我不是Linux专家,但这看起来像redhat6(默认为python2.6)[1]。4.4是GCC的版本。在安装python 2.2版本时,您仍不需要将python 7.2安装到6.2版中,而不需要安装2.2版的python软件。在

[1]How to confirm RedHat Enterprise Linux version? [2] https://developers.redhat.com/products/softwarecollections/hello-world/#fndtn-python

旧版本的redhat(6及更早版本)中的yum命令可用于python2.6

您是否使用unlink/usr/bin/python测试yum命令,并在/bin/python到/usr/bin/python2.6中添加新的链接?在

如果结果类似于相同的错误,请尝试重新编译python6或更新服务器上的yum pkgs

相关问题 更多 >