0

This question already has an answer here:

Okay, seems like I have messed up Python versions, because I can find three different python interpreters when I check if PyCharm IDE.

  • usr/bin/python2.7
  • usr/bin/python3.4
  • Custom Anaconda built. ( python3.5)

The problem is, I have installed GTK+ plus, but only Python2 sees it. When I start Python3.4 or Python 3.5 (command "python" opens up Python3.5, Anaconda built), it gives,

ImportError: No module named 'gtk'

error. I have run

sudo apt-get install libgtk-3-dev

to install GTK+. As I said, only python2 imports it.


I also tried: With Python3.5:

from gi.repository import Gtk

I get:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/USERNAME/.anaconda3/lib/python3.5/site-packages/gi/__init__.py", line 39
print url
        ^
SyntaxError: Missing parentheses in call to 'print'

And I tried with Python 3.4:

from gi.repository import Gtk

I get:

** (.:3864): WARNING **: Couldn't connect to accessibility bus: Failed to connect to socket /tmp/dbus-fJ15USrbo1: Connection refused

marked as duplicate by NGRhodes, David Foerster, edwinksl, Pilot6, TheWanderer Oct 1 '16 at 14:24

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • I edited to be more specific, could you take a look again please? thanks. – hrkucuk Oct 1 '16 at 13:14
  • Do the answers in the duplicate question help? – edwinksl Oct 1 '16 at 18:29
  • PyGTK only works with Python 2, the duplicate answer explains how to use PyGI instead. The SyntaxError on that print line is because of a change from Python 2 to 3, not GTK. See here: docs.python.org/3/whatsnew/3.0.html#print-is-a-function The warning on 3.4 can probably be safely ignoed. – Timo Oct 2 '16 at 8:26