[英]PyGObject on Windows “ERROR:root:Could not find any typelib for Gtk”
I need help setting up PyGObject under Windows. 我需要在Windows下设置PyGObject的帮助。 I've installed it but I get the following error when importing
Gtk
and Gdk
from gi.repository
我已经安装了它,但是从
gi.repository
导入Gtk
和Gdk
时出现以下错误
ERROR:root:Could not find any typelib for Gtk
Traceback (most recent call last):
File "example.py", line 2, in <module>
from gi.repository import Gtk
ImportError: cannot import name Gtk
I'm able to import gi.repository.GLib
, gi.repository.Gio
, gi.repository.GObject
, gi.repository.cairo
and cairo
but I can't import gi.repository.Gtk
and gi.repository.Gdk
and gi.repository.GdkPixbuf
. 我能够导入
gi.repository.GLib
, gi.repository.Gio
, gi.repository.GObject
, gi.repository.cairo
和cairo
但是我无法导入gi.repository.Gtk
和gi.repository.Gdk
和gi.repository.GdkPixbuf
。
I have tried uninstalling it from the uninstaller in add/remove programs and then reinstalling it but the error persisted. 我尝试从添加/删除程序的卸载程序中卸载它,然后重新安装它,但错误仍然存在。
If someone could help that would be really appreciated. 如果有人可以帮助,将不胜感激。
I dont know if this is the right answer but check if you have Gtk-version_number.typelib file in you installation. 我不知道这是否是正确的答案,但请检查您的安装中是否有Gtk-version_number.typelib文件。 I had similar problem but I had this problem when I built my program with pyinstaller.
我有类似的问题,但是当我使用pyinstaller构建程序时遇到了这个问题。 I just copied .typelib files and my program worked.
我只是复制了.typelib文件,并且程序正常运行。 I dont know if this applies here but try finding that file and copying to installation sub directory where other .typelib files are.
我不知道这是否适用于此,但是尝试查找该文件并将其复制到其他.typelib文件所在的安装子目录中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.