鱼C论坛

 找回密码
 立即注册
查看: 1573|回复: 2

换个电脑pyautogui.locateOnScreen('d.png')报错

[复制链接]
发表于 2022-6-8 22:38:32 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
import pyautogui
import time
from pyautogui import moveTo as MoveTo
from time import sleep as Delay
from pyautogui import click as LeftClick

while True:
    cj=pyautogui.locateOnScreen("d.png")
    if  cj is not None:
        print(cj)
        MoveTo(1615, 838)
        Delay (1000)
        LeftClick()
        MoveTo(1648, 360)
        Delay(15000)
        LeftClick()
其他电脑运行没问题,但是有一台运行后报错
cj=pyautogui.locateOnScreen("d.png")这句
Traceback (most recent call last):
  File "D:\新建文件夹 (3)\mh.py", line 8, in <module>
    cj=pyautogui.locateOnScreen("d.png")
  File "C:\Users\79387\AppData\Local\Programs\Python\Python310\lib\site-packages\pyautogui\__init__.py", line 175, in wrapper
    return wrappedFunction(*args, **kwargs)
  File "C:\Users\79387\AppData\Local\Programs\Python\Python310\lib\site-packages\pyautogui\__init__.py", line 213, in locateOnScreen
    return pyscreeze.locateOnScreen(*args, **kwargs)
  File "C:\Users\79387\AppData\Local\Programs\Python\Python310\lib\site-packages\pyscreeze\__init__.py", line 372, 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\79387\AppData\Local\Programs\Python\Python310\lib\site-packages\pyscreeze\__init__.py", line 144, in wrapper
    raise PyScreezeException('The Pillow package is required to use this function.')
pyscreeze.PyScreezeException: The Pillow package is required to use this function.
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2022-6-8 22:51:21 | 显示全部楼层
装一下Pillow这个模块
pip install pillow
有这个模块的话就重装一下Pillow
pip uninstall pillow
pip install pillow
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2022-6-9 00:15:09 | 显示全部楼层
临时号 发表于 2022-6-8 22:51
装一下Pillow这个模块

有这个模块的话就重装一下Pillow

pip install opencv-python
后面竟然还要装这个,之前的电脑没有这么复杂。谢谢啦
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-11-17 23:47

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表