为什么python3不能导入gi.repository?
Python2不会遇到同样的问题。
greg@greg-precise:~$ python3 Python 3.2.3 (default, May 3 2012, 15:51:42) [GCC 4.6.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from gi.repository import Gtk Traceback (most recent call last): File "", line 1, in ImportError: No module named gi.repository
(为清晰起见添加了换行符)
你应该安装正确的Python 3软件包,它们以python3-
而不是python-
为前缀。
这样就可以了:
sudo apt-get install python3-gi
或者在您最喜欢的包管理器中搜索此包。