I have Ubuntu 14.04 with python-2.7 and python-3 support. I am porting my python application from python-2.7 to python-3. I have example.py
file which is importing below модулируй. and I #!/usr/bin/python3
эксперт python evn изменчивый.
import gtk, gobject, time, sys, os, subprocess, signal
**ImportError: No module named 'gtk'**
I am getting above ошибка, when trying to run with python3.
Any разрабатывает what is missing here?
попробуйте:
from gi.repository import Gtk
и замените gtk
на Gtk
в вашем коде
или
from gi.repository import Gtk as gtk
смотрите также : Python GTK+ 3 Tutorial : Getting Starting
Используйте GObject introspection основанные на Python3 привязки для Gtk и друзей:
from gi.repository import Gtk, GObject
Для этого нужен пакет python3-gi
, который установлен по умолчанию.
Некоторые имена изменились со времен PyGTK. Ссылка на Python GObject Introbject API должна помочь вам найти новые имена (и другие изменения).