Python 3 pyAutoGUI - 我无法使用截图功能
Python 3 pyAutoGUI - I can't use screenshot functions
我尝试从文档中导入:
import pyautgui
pyautogui.click(pyautogui.locateOnScreen("select.png"))
我在第 2 行收到这些错误:
File "C:\log\WinPython-64bit-3.5.4.0Qt5\python-3.5.4.amd64\lib\site-packages\pyscreeze\__init__.py", line 267, in locateOnScreen
screenshotIm = screenshot(region=None) # the locateAll() function must handle cropping to return accurate coordinates, so don't pass a region here.
File "C:\log\WinPython-64bit-3.5.4.0Qt5\python-3.5.4.amd64\lib\site-packages\pyscreeze\__init__.py", line 314, in _screenshot_win32
im = ImageGrab.grab()
NameError: name 'ImageGrab' is not defined
你能帮忙吗?
看来您需要导入 ImageGrab
from PIL import ImageGrab
我尝试从文档中导入:
import pyautgui
pyautogui.click(pyautogui.locateOnScreen("select.png"))
我在第 2 行收到这些错误:
File "C:\log\WinPython-64bit-3.5.4.0Qt5\python-3.5.4.amd64\lib\site-packages\pyscreeze\__init__.py", line 267, in locateOnScreen
screenshotIm = screenshot(region=None) # the locateAll() function must handle cropping to return accurate coordinates, so don't pass a region here.
File "C:\log\WinPython-64bit-3.5.4.0Qt5\python-3.5.4.amd64\lib\site-packages\pyscreeze\__init__.py", line 314, in _screenshot_win32
im = ImageGrab.grab()
NameError: name 'ImageGrab' is not defined
你能帮忙吗?
看来您需要导入 ImageGrab
from PIL import ImageGrab