python之pyautogui框架下图片识别失败问题

时间:2025-03-15 08:29:45
import pyautogui
import time

(2)

#获取指定元素的坐标
target_pos = ('img/help_btn.png')
target_center_pos = (target_pos)

#移动鼠标
(target_center_pos,duration = 1 )
()

如果只是pip pyautogui的情况下,可能会出现以下异常

imageNotFoundException

这个时候,需要pip install opencv-python

就可以成功识别