2016-12-08 89 views
1

我目前正在尝试使用GTK3和Python3进行GUI开发。Windows3上的Python3和GTK3

一切正常,而这样做我的Ubuntu设备上,但我希望能有后来的Windows可执行文件,我需要设置这些工具了在Windows 7

我的Python 3.4.4 (64位)安装在我的系统上,并试图从Stackoverflow上的其他帖子的解决方案,以便能够使用GTK,但我无法让它工作。

当试图对Python的外壳导入基于GTK(import gifrom 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 

我在此刻安装什么:

哪种方法可以在Windows上获得Python3和GTK3的工作集? (据我所见,使用Ubuntu创建Windows可执行文件是不可能的。)

+0

请发布此代码并带来此错误以进行调试简化 –

+0

@ArduinoSentinel该代码已包含在我的文章中(请参阅错误消息上方的段落)。 – epR8GaYuh

+0

@oldtechaa GNOME PyGObject页面上的链接引导我进入我在文章中已经提到的Sourceforge项目页面,但似乎不起作用。 – epR8GaYuh

回答

2

您只需要在sourceforge(您在文章中提到的那个)上安装Python 3.4和PyGObject项目。 此设置必须在Windows上工作,因为它适用于我。

也许你错过了在安装PyGObject期间检查Gtk3库(这是一个频繁的错误)。

你根本不需要msys2就可以在Python中使用PyGObject。

+0

感谢您指出默认情况下未选中此选项,并且您在滚动长列表时必须注意这一点。不行。 – epR8GaYuh

+0

让我们尝试卸载并重新安装Python和PyGObject。 – pozzugno

+0

对不起,错过了我键盘上的右键。应该是“Now it works”;) – epR8GaYuh