无法打开软件中心(没有名为gi.repository的模块)+ yum(没有名为yum的模块),(ubuntu)

时间:2016-04-29 16:11:44

标签: python linux ubuntu yum pyenv

我的操作系统是VirtualBox中的ubuntu 15.10,我发现无法升级我的操作系统而无法打开软件中心。 我试图谷歌这个问题,但当我找到一些方法,我可以尝试..我会发现更多的新问题。而且无法解决这些问题。

我试着详细描述我做了什么以及计算机的条件(错误信息)..谢谢!

$ software-center

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

我谷歌“没有名为gi.repository的模块”,发现我需要安装PyGObject,但是..

$ sudo pip install PyGObject

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/

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

/home/thisray/.pyenv/shims/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.

$ python -c“import gi; print(gi .__ spec __)”

Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named gi

$ python -c“import gi; print(gi .__ dict __)”

Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named gi

  • 关于yum

    的问题

$ sudo apt-get install yum

yum is the newest version  ( in Taiwanese )

$ yum --version

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

$ whereis python

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


我尝试$ sudo vi /usr/bin/yum并将#!/usr/bin/python修改为$ whereis python中的每个路径,并使用不同版本的Python来>> import yum,但yum仍然不要工作

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

$ pyenv版本

* system (set by /home/thisray/.pyenv/version)
  2.7.11
  3.5.1

(我通常使用$ pyenv global 2.7.11

$ pip --version

pip 8.1.1 from /home/thisray/lib/python2.7/site-packages (python 2.7)

$ pip list

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,而且我没有使用好的方法来安装/升级它们....

这是我第一次在这里用英语提问。我希望你能理解我的意思和我的问题。非常感谢并对我的英语感到抱歉,我一整天都试图解决这个问题......如果问题得以解决,我将非常感谢!

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

0 个答案:

没有答案