簡體   English   中英

Windows上的Python3和GTK3

[英]Python3 and GTK3 on Windows

我目前正在嘗試使用GTK3和Python3進行GUI開發。

在我的Ubuntu設備上執行此操作時,一切工作都很好,但是由於我希望以后能夠擁有Windows可執行文件,因此我需要在Windows 7上設置這些工具。

我的系統上安裝了Python 3.4.4(64位),並嘗試了Stackoverflow上其他文章的解決方案以使其能夠使用GTK,但我無法使其正常工作。

嘗試在Python Shell上導入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可執行文件。)

您只需要在sourceforge(您在帖子中提到的那個)上安裝Python 3.4和PyGObject項目。 此設置必須在Windows上可以使用,因為它適用於我。

也許您在安裝PyGObject的過程中錯過了檢查Gtk3庫的操作(這是一個常見錯誤)。

您完全不需要msys2在Python中使用PyGObject。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM