How do I fix melds 'Cannot import: GTK+' e

2019-02-26 05:46发布

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)

2条回答
家丑人穷心不美
2楼-- · 2019-02-26 05:51

I had the gi package installed:

$ sudo pip uninstall gi

fixed my problem.

查看更多
叼着烟拽天下
3楼-- · 2019-02-26 06:03

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.

查看更多
登录 后发表回答