How do I fix melds 'Cannot import: GTK+' error caused by missing 'gi.repository'?

﹥>﹥吖頭↗ 提交于 2019-12-02 04:06:37

问题


I've recently started learning GTK+ development and installed some new packages (I don't remember which ones). Now the merge tool meld doesn't work any more:

Cannot import: GTK+
No module named repository

This is caused by line 155 of the meld executable:

from gi.repository import Gtk

Note that I can import gi.repository in Python 3, but it is not so simple to convert meld to Python 3.

How can I fix it?

What I've tried:

  • sudo apt-get install python-gobject: Was already installed (source)

回答1:


I had the gi package installed:

$ sudo pip uninstall gi

fixed my problem.




回答2:


I just encountered this - but forgot that I was working inside a virtualenv that didn't have this stuff installed. Just needed to run the command from outside the virtualenv.



来源:https://stackoverflow.com/questions/28657717/how-do-i-fix-melds-cannot-import-gtk-error-caused-by-missing-gi-repository

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!