&引用;没有名为yum的模块;使用Python2.7

&引用;没有名为yum的模块;使用Python2.7,python,python-2.7,yum,Python,Python 2.7,Yum,我需要在我的项目中使用Python 2.7。但是在安装Python之后,我不能使用模块yum。我有一个错误: [root@nexus-chat2 .synapse]# yum 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 pa

我需要在我的项目中使用Python 2.7。但是在安装Python之后,我不能使用模块yum。我有一个错误:

[root@nexus-chat2 .synapse]# yum
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, Feb 19 2018, 14:55:04) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-18)]

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

你知道我该怎么解决吗?我使用CentOS 6

时,
yum
模块不是常用的Python模块。它需要为系统上安装的任何Python版本显式构建和安装。对于CentOS 6,系统Python是Python 2.6(默认情况下,
yum
模块可用)

如果您想使
yum
模块可用于Python2.7安装,则需要针对Python2.7安装构建
yum
,这可能是一项非常重要的任务


最简单的解决方案是(a)只需使用Python 2.6或(b)升级到较新的发行版。

yum模块不是一个常用的Python模块。它需要为系统上安装的任何Python版本显式构建和安装。对于CentOS 6,系统Python是Python 2.6(默认情况下,
yum
模块可用)

如果您想使
yum
模块可用于Python2.7安装,则需要针对Python2.7安装构建
yum
,这可能是一项非常重要的任务


最简单的解决方案是(a)只需使用Python 2.6或(b)升级到最新的发行版。

您是否尝试过通过
rpm
重新安装
yum
?或者尝试过转到建议的页面“如果您自己无法解决问题”?不,它将尝试这些解决方案。@SembeiNorimaki感谢您的评论非常有用@iamauser我通过rpm安装了yum,但它没有改变任何东西,因为它是有问题的Python版本,我认为不是yum。您是否尝试过通过
rpm
重新安装
yum
?或者尝试过转到建议页面“如果您自己无法解决问题”?不,它将尝试这些解决方案。@SembeiNorimaki感谢您的评论非常有用@iamauser我通过rpm安装了yum,但它没有改变任何东西,因为它是有问题的Python版本,我认为不是yum。