install pygtk for python 3.6.1 on Windows 10

╄→尐↘猪︶ㄣ 提交于 2020-12-30 18:05:03

问题


Since PIL.ImageGrab() gave me some problems, I read further into the topic and it seems that gtk is the better solution for making Screenshots. But I don't understand which packages are actually working and which are deprecated. trying

pip install pygtk

gives me

ERROR: Could not import dsextras module: Make sure you have installed pygobject.

pygobject doesn't exist, installing gobject doesn't help.

I tried some variants of the module name like python3- or just 3 at the end, but I don't seem to get the right one.


回答1:


The full chat session about this is here. The original solution can be read here, especially the comment made by @cdarke.

So anyway, the solution is to use Python3.5 intead of 3.6 or newer, at least until MSYS2 is updated.

As a sidenote, you really don't want to use pygtk (which is based on Gtk2). Use pygobject like such:

import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk



回答2:


for GTK+, you have to do the following:

from gi.repository import Gtk

and not:

import gtk


来源:https://stackoverflow.com/questions/43529675/install-pygtk-for-python-3-6-1-on-windows-10

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!