import pyautogui
while True:
location = pyautogui.locateCenterOnScreen('danjiceshi222.png',confidence = 0.95)
if location:
break
pyautogui.click(location)
很简单的几句代码,查找屏幕上的某个图标,找到后单击打开
在pycharm中写的代码,在pycharm中运行没有任何问题。
使用pyinstaller打包成exe后,双击exe运行报错。出现的错误提示如下:
Traceback (most recent call last): File "pyautogui\__init__.py", line 172, in wrapper File "pyautogui\__init__.py", line 204, in locateCenterOnScreen File "pyscreeze\__init__.py", line 447, in locateCenterOnScreen File "pyscreeze\__init__.py", line 405, in locateOnScreen File "pyscreeze\__init__.py", line 383, in locate File "pyscreeze\__init__.py", line 257, in _locateAll_opencvpyscreeze.ImageNotFoundException: Could not locate the image (highest confidence = 0.403)During handling of the above exception, another exception occurred:Traceback (most recent call last): File "YBTS_pyautogui.py", line 30, in <module> File "pyautogui\__init__.py", line 174, in wrapperpyautogui.ImageNotFoundException
本人由2台电脑,笔记本同样的操作无问题,台式机打包的exe就会报上述错误。网上查了好久都没有解决,请高手帮忙指点下,万分感谢!
while True:
location = pyautogui.locateCenterOnScreen('danjiceshi222.png',confidence = 0.95)
if location:
break
pyautogui.click(location)
很简单的几句代码,查找屏幕上的某个图标,找到后单击打开
在pycharm中写的代码,在pycharm中运行没有任何问题。
使用pyinstaller打包成exe后,双击exe运行报错。出现的错误提示如下:
Traceback (most recent call last): File "pyautogui\__init__.py", line 172, in wrapper File "pyautogui\__init__.py", line 204, in locateCenterOnScreen File "pyscreeze\__init__.py", line 447, in locateCenterOnScreen File "pyscreeze\__init__.py", line 405, in locateOnScreen File "pyscreeze\__init__.py", line 383, in locate File "pyscreeze\__init__.py", line 257, in _locateAll_opencvpyscreeze.ImageNotFoundException: Could not locate the image (highest confidence = 0.403)During handling of the above exception, another exception occurred:Traceback (most recent call last): File "YBTS_pyautogui.py", line 30, in <module> File "pyautogui\__init__.py", line 174, in wrapperpyautogui.ImageNotFoundException

本人由2台电脑,笔记本同样的操作无问题,台式机打包的exe就会报上述错误。网上查了好久都没有解决,请高手帮忙指点下,万分感谢!