无法在python上找到图像 [英] Can't locate image on python

查看:56
本文介绍了无法在python上找到图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在我的屏幕上定位图像.但它总是显示这个 -

I try to locate an image on my screen. But it always shows this -

Traceback (most recent call last):
  File "C:/Users/MerazulIslam/Desktop/ZOOM_BOT/bot.py", line 20, in <module>
    find_btn = pyautogui.locateOnScreen(r'C:\Users\MerazulIslam\Desktop\ZOOM_BOT\Capture.PNG', confidene=0.5)
  File "C:\Users\MerazulIslam\AppData\Roaming\Python\Python38\site-packages\pyautogui\__init__.py", line 175, in wrapper
    return wrappedFunction(*args, **kwargs)
  File "C:\Users\MerazulIslam\AppData\Roaming\Python\Python38\site-packages\pyautogui\__init__.py", line 213, in locateOnScreen
    return pyscreeze.locateOnScreen(*args, **kwargs)
  File "C:\Users\MerazulIslam\AppData\Roaming\Python\Python38\site-packages\pyscreeze\__init__.py", line 359, 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:\Users\MerazulIslam\AppData\Roaming\Python\Python38\site-packages\pyscreeze\__init__.py", line 134, in wrapper
    raise PyScreezeException('The Pillow package is required to use this function.')
pyscreeze.PyScreezeException: The Pillow package is required to use this function.

我的代码-

import pyautogui

find_btn = pyautogui.locateOnScreen(r'C:\Users\MerazulIslam\Desktop\bot\Capture.PNG')
print(find_btn)

请帮忙!

推荐答案

您可以尝试重新安装 pyautogui 和所有依赖项,以确保没有丢失任何东西:

You can just try to reinstall pyautogui with all dependencies to make sure nothing missing:

pip install --upgrade --force-reinstall pyautogui

这篇关于无法在python上找到图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆