我目前正在尝试使用GTK3和Python3进行GUI开发。
在我的Ubuntu设备上执行此操作时一切正常,但由于我希望以后可以使用Windows可执行文件,我需要在Windows 7上设置这些工具。
我的系统上安装了Python 3.4.4(64位),并尝试使用Stackoverflow上的其他帖子解决方案,以便能够使用GTK,但我无法使用它。
尝试在Python shell上导入Gtk(import gi
和from gi.repository import Gtk
)时,会出现以下错误:
Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 2158, in _find_spec
AttributeError: 'DynamicImporter' object has no attribute 'find_spec'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python34\lib\site-packages\gi\importer.py", line 100, in find_module
'introspection typelib not found' % namespace)
ImportError: cannot import name Gtk, introspection typelib not found
我目前安装的内容:
bin
目录包含在PATH中)在Windows上获取一组Python3和GTK3的最佳方法是什么? (据我所知,使用Ubuntu无法创建Windows可执行文件。)
答案 0 :(得分:2)
您只需要在sourceforge上安装Python 3.4和PyGObject项目(您在帖子中提到的那个)。 此设置必须在Windows上运行,因为它适用于我。
也许你错过了在安装PyGObject期间检查Gtk3库(这是一个经常出错的错误)。
你根本不需要msys2来在Python中使用PyGObject。