python3pyautogui-我可以';不要使用屏幕截图功能
我尝试从文档中导入:python3pyautogui-我可以';不要使用屏幕截图功能,python,automation,screenshot,pyautogui,Python,Automation,Screenshot,Pyautogui,我尝试从文档中导入: 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 = screensh
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
PIL在Python 3中已经过时了!pyautogui需要python3。因此,当我遇到这个问题时,我安装了枕头版本4.2.1。请注意,除了那些正在制作屏幕截图的函数外,pyautogui中的所有函数都正常。非常感谢您的帮助经过一些研究,我发现枕头可以有效地取代PIL库,但必须像这样导入“导入PIL”!!。所以skr如果你安装了枕头而不是PIL,你是完全正确的