问题
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