Python Can';t开放软件中心(没有名为gi.repository的模块)和#x2B;yum(没有名为yum的模块),(ubuntu)

Python Can';t开放软件中心(没有名为gi.repository的模块)和#x2B;yum(没有名为yum的模块),(ubuntu),python,linux,ubuntu,yum,pyenv,Python,Linux,Ubuntu,Yum,Pyenv,我的操作系统是VirtualBox中的Ubuntu15.10,我发现我无法升级操作系统,也无法打开软件中心。 我曾尝试用谷歌搜索这个问题,但当我找到一些方法时,我可以尝试。。我也会发现更多的新问题。而不能解决这些问题 我试图详细描述我所做的事情以及计算机的状况(错误消息)。。谢谢 $软件中心 Traceback (most recent call last): File "/usr/bin/software-center", line 25, in <module> fr

我的操作系统是VirtualBox中的Ubuntu15.10,我发现我无法升级操作系统,也无法打开软件中心。 我曾尝试用谷歌搜索这个问题,但当我找到一些方法时,我可以尝试。。我也会发现更多的新问题。而不能解决这些问题

我试图详细描述我所做的事情以及计算机的状况(错误消息)。。谢谢

$软件中心

Traceback (most recent call last):
  File "/usr/bin/software-center", line 25, in <module>
    from gi.repository import Gtk, GObject
ImportError: No module named gi.repository
  


  

  • 我遵循

      

$which python(我是否可以/应该将其修改为
/usr/bin/python
?)

$pacman-Qikk python-gobject python

XIO:  fatal IO error 22 (Invalid argument) on X server ":0"
      after 4155 requests (4155 known processed) with 0 events remaining.
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.11 (default, Apr 25 2016, 16:08:52) 
[GCC 5.2.1 20151010]

If you cannot solve this problem yourself, please go to 
the yum faq at:
  http://yum.baseurl.org/wiki/Faq
python: /usr/bin/python2.7-config /usr/bin/python3.4m 
/usr/bin/python2.7-dbg /usr/bin/python3.4 
/usr/bin/python2.7 /usr/bin/python3.5m 
/usr/bin/python2.7-dbg-config /usr/bin/python 
/usr/bin/python3.5 /usr/lib/python3.4 
/usr/lib/python2.7 /usr/lib/python3.5 
/etc/python3.4 /etc/python2.7 /etc/python /etc/python3.5 
/usr/local/bin/python2.7-config /usr/local/bin/python2.7 
/usr/local/lib/python3.4 /usr/local/lib/python2.7 
/usr/local/lib/python3.5 /usr/include/python3.4m 
/usr/include/python2.7 /usr/include/python3.5m 
/usr/include/python2.7_d /usr/share/python 
/home/thisray/.pyenv/shims/python3.5m-config 
/home/thisray/.pyenv/shims/python2.7-config 
/home/thisray/.pyenv/shims/python2.7 
/home/thisray/.pyenv/shims/python3.5-config 
/home/thisray/.pyenv/shims/python3.5m 
/home/thisray/.pyenv/shims/python 
/home/thisray/.pyenv/shims/python3.5 
/home/thisray/bin/python2.7 
/home/thisray/bin/python /usr/share/man/man1/python.1.gz
pip 8.1.1 from /home/thisray/lib/python2.7/site-packages (python 2.7)
$python-c“导入gi;打印(gi.\uuu规范)”

$yum--version

XIO:  fatal IO error 22 (Invalid argument) on X server ":0"
      after 4155 requests (4155 known processed) with 0 events remaining.
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.11 (default, Apr 25 2016, 16:08:52) 
[GCC 5.2.1 20151010]

If you cannot solve this problem yourself, please go to 
the yum faq at:
  http://yum.baseurl.org/wiki/Faq
python: /usr/bin/python2.7-config /usr/bin/python3.4m 
/usr/bin/python2.7-dbg /usr/bin/python3.4 
/usr/bin/python2.7 /usr/bin/python3.5m 
/usr/bin/python2.7-dbg-config /usr/bin/python 
/usr/bin/python3.5 /usr/lib/python3.4 
/usr/lib/python2.7 /usr/lib/python3.5 
/etc/python3.4 /etc/python2.7 /etc/python /etc/python3.5 
/usr/local/bin/python2.7-config /usr/local/bin/python2.7 
/usr/local/lib/python3.4 /usr/local/lib/python2.7 
/usr/local/lib/python3.5 /usr/include/python3.4m 
/usr/include/python2.7 /usr/include/python3.5m 
/usr/include/python2.7_d /usr/share/python 
/home/thisray/.pyenv/shims/python3.5m-config 
/home/thisray/.pyenv/shims/python2.7-config 
/home/thisray/.pyenv/shims/python2.7 
/home/thisray/.pyenv/shims/python3.5-config 
/home/thisray/.pyenv/shims/python3.5m 
/home/thisray/.pyenv/shims/python 
/home/thisray/.pyenv/shims/python3.5 
/home/thisray/bin/python2.7 
/home/thisray/bin/python /usr/share/man/man1/python.1.gz
pip 8.1.1 from /home/thisray/lib/python2.7/site-packages (python 2.7)
$python在哪里

XIO:  fatal IO error 22 (Invalid argument) on X server ":0"
      after 4155 requests (4155 known processed) with 0 events remaining.
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.11 (default, Apr 25 2016, 16:08:52) 
[GCC 5.2.1 20151010]

If you cannot solve this problem yourself, please go to 
the yum faq at:
  http://yum.baseurl.org/wiki/Faq
python: /usr/bin/python2.7-config /usr/bin/python3.4m 
/usr/bin/python2.7-dbg /usr/bin/python3.4 
/usr/bin/python2.7 /usr/bin/python3.5m 
/usr/bin/python2.7-dbg-config /usr/bin/python 
/usr/bin/python3.5 /usr/lib/python3.4 
/usr/lib/python2.7 /usr/lib/python3.5 
/etc/python3.4 /etc/python2.7 /etc/python /etc/python3.5 
/usr/local/bin/python2.7-config /usr/local/bin/python2.7 
/usr/local/lib/python3.4 /usr/local/lib/python2.7 
/usr/local/lib/python3.5 /usr/include/python3.4m 
/usr/include/python2.7 /usr/include/python3.5m 
/usr/include/python2.7_d /usr/share/python 
/home/thisray/.pyenv/shims/python3.5m-config 
/home/thisray/.pyenv/shims/python2.7-config 
/home/thisray/.pyenv/shims/python2.7 
/home/thisray/.pyenv/shims/python3.5-config 
/home/thisray/.pyenv/shims/python3.5m 
/home/thisray/.pyenv/shims/python 
/home/thisray/.pyenv/shims/python3.5 
/home/thisray/bin/python2.7 
/home/thisray/bin/python /usr/share/man/man1/python.1.gz
pip 8.1.1 from /home/thisray/lib/python2.7/site-packages (python 2.7)
  
我尝试了
$sudo vi/usr/bin/yum
并修改了
#/usr/bin/python
$where is python
中的每个路径,并使用不同版本的python导入yum,但是
yum
仍然不起作用

  


  

  • 我已经安装了
    pyenv
    ,并尝试了三个版本来测试
    yum

      

$pyenv版本

* system (set by /home/thisray/.pyenv/version)
  2.7.11
  3.5.1
(我通常使用
$pyenv global 2.7.11

$pip——版本

XIO:  fatal IO error 22 (Invalid argument) on X server ":0"
      after 4155 requests (4155 known processed) with 0 events remaining.
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.11 (default, Apr 25 2016, 16:08:52) 
[GCC 5.2.1 20151010]

If you cannot solve this problem yourself, please go to 
the yum faq at:
  http://yum.baseurl.org/wiki/Faq
python: /usr/bin/python2.7-config /usr/bin/python3.4m 
/usr/bin/python2.7-dbg /usr/bin/python3.4 
/usr/bin/python2.7 /usr/bin/python3.5m 
/usr/bin/python2.7-dbg-config /usr/bin/python 
/usr/bin/python3.5 /usr/lib/python3.4 
/usr/lib/python2.7 /usr/lib/python3.5 
/etc/python3.4 /etc/python2.7 /etc/python /etc/python3.5 
/usr/local/bin/python2.7-config /usr/local/bin/python2.7 
/usr/local/lib/python3.4 /usr/local/lib/python2.7 
/usr/local/lib/python3.5 /usr/include/python3.4m 
/usr/include/python2.7 /usr/include/python3.5m 
/usr/include/python2.7_d /usr/share/python 
/home/thisray/.pyenv/shims/python3.5m-config 
/home/thisray/.pyenv/shims/python2.7-config 
/home/thisray/.pyenv/shims/python2.7 
/home/thisray/.pyenv/shims/python3.5-config 
/home/thisray/.pyenv/shims/python3.5m 
/home/thisray/.pyenv/shims/python 
/home/thisray/.pyenv/shims/python3.5 
/home/thisray/bin/python2.7 
/home/thisray/bin/python /usr/share/man/man1/python.1.gz
pip 8.1.1 from /home/thisray/lib/python2.7/site-packages (python 2.7)
$pip列表

Collecting PyGObject
  Downloading pygobject-2.28.3.tar.bz2 (889kB)
    100% |████████████████████████████████| 890kB 917kB/s 
    Complete output from command python setup.py egg_info:
    ********************************************************************
    * Building PyGObject using distutils is only supported on windows. *
    * To build PyGObject in a supported way, read the INSTALL file.    *
    ********************************************************************

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-gaC6QU/PyGObject/
pip (8.1.1)
setuptools (20.10.1)
wheel (0.29.0)
  
$/usr/bin/python2.7-dbg

Python 2.7.10 (default, Oct 14 2015, 16:09:02) 
[GCC 5.2.1 20151010] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import yum
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/yum/__init__.py", line 23, in <module>
    import rpm
  File "/usr/lib/python2.7/dist-packages/rpm/__init__.py", line 9, in <module>
    from rpm._rpm import *
ImportError: /usr/lib/python2.7/dist-packages/rpm/_rpm.x86_64-linux-gnu.so: undefined symbol: Py_InitModule4_64
[52069 refs]
Python 2.7.10(默认,2015年10月14日,16:09:02)
[GCC 5.2.1 20151010]关于linux2
有关详细信息,请键入“帮助”、“版权”、“信用证”或“许可证”。
>>>导入yum
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
文件“/usr/lib/python2.7/dist-packages/yum/_-init__.py”,第23行,在
导入rpm
文件“/usr/lib/python2.7/dist-packages/rpm/_-init___.py”,第9行,在
从rpm.\u rpm导入*
ImportError:/usr/lib/python2.7/dist-packages/rpm//u rpm.x86\u 64-linux-gnu.so:未定义符号:Py\u InitModule4\u 64
[参考文献52069]

  

我认为所有问题的根源在于我安装了许多不同版本的Python,并且我没有使用良好的方式来安装/升级它们

这是我第一次在这里用英语提问。我希望你能理解我的意思和我的问题是什么。非常感谢,很抱歉我的英语,我一整天都在努力解决它。。。如果问题能够解决,我将非常感激


如果有什么需要测试或解释的,请告诉我,谢谢

您是正确的,您的问题可能都源于替换系统Python。通常,您不应该将使用
apt get
的软件包与使用
pip install
安装的软件包混用,因为这两个系统具有不同的管理软件依赖关系的机制,并且
pip installing
系统中的某些东西可能会破坏您的系统。此时,您最好的恢复选项可能是从头开始重新安装。另外,Ubuntu没有使用
yum
,也不清楚您为什么要使用它(CentOS/Fedora/Red Hat上使用了
yum
)。您的问题可能都源于更换系统Python。通常,您不应该将使用
apt get
的软件包与使用
pip install
安装的软件包混用,因为这两个系统具有不同的管理软件依赖关系的机制,并且
pip installing
系统中的某些东西可能会破坏您的系统。此时,您最好的恢复选项可能是从头开始重新安装。另外,Ubuntu没有使用
yum
,也不清楚您为什么要使用它(CentOS/Fedora/Red Hat上使用了
yum
)。