Error "could Not Find Any Typelib For Gtk" With Python3 And Gtk3
I cannot make Python3 work with GTK3. I'm in a cluster context and I had everything recompiled from the sources. When I run a simple example : from gi.repository import Gtk win =
Solution 1:
There are typically additional packages to install depending on what you want to introspect. The one I found that was crucial was gir1.2-gtk-3.0 (or 2.0 depending which version you are coding against).
Solution 2:
The problem is due to the compiled version of GTK3 that was not referenced in gobject-introspection.
It is simple to check the problem by listing the .typelib
files in gobject-introspection
$ which g-ir-scanner /Produits/publics/x86_64.Linux.RH6/gobject-introspection/1.40.0/bin/g-ir-scanner $ ls /Produits/publics/x86_64.Linux.RH6/gobject-introspection/1.40.0/lib/girepository-1.0/ cairo-1.0.typelib fontconfig-2.0.typelib GIRepository-2.0.typelib GModule-2.0.typelib win32-1.0.typelib xlib-2.0.typelib DBus-1.0.typelib freetype2-2.0.typelib GL-1.0.typelib GObject-2.0.typelib xfixes-4.0.typelib xrandr-1.3.typelib DBusGLib-1.0.typelib Gio-2.0.typelib GLib-2.0.typelib libxml2-2.0.typelib xft-2.0.typelib
The problem should be solved by recompiling GTK (and its dependencies) with the configure option --enable-introspection=yes
.
Solution 3:
Try using the following code:
import gi
gi.require_version("Gtk", "3.0")
from gi.repositoryimportGTK
Post a Comment for "Error "could Not Find Any Typelib For Gtk" With Python3 And Gtk3"