[英]Why my code don't work when I pass it to .exe?
I made a program that detects an image on the screen, I use for it the pyautogui library, when I run my program it works perfectly well, but when I pass it in executable, it does not work anymore and I have the error message below.我制作了一个程序来检测屏幕上的图像,我使用了 pyautogui 库,当我运行我的程序时它工作得很好,但是当我将它传递给可执行文件时,它不再工作了,我有下面的错误消息.
I am under windows 10. I have python 3.10 and pyinstaller 5.0我在 Windows 10 下。我有 python 3.10 和 pyinstaller 5.0
The error message :错误信息:
Traceback (most recent call last):
File "interface.py", line 21, in <module>
ScreenLocation = pa.locateOnScreen('module\images\location.PNG', confidence=0.7)
File "pyautogui\__init__.py", line 175, in wrapper
File "pyautogui\__init__.py", line 213, in locateOnScreen
File "pyscreeze\__init__.py", line 373, in locateOnScreen
File "pyscreeze\__init__.py", line 353, in locate
File "pyscreeze\__init__.py", line 253, in _locateAll_python
NotImplementedError: The confidence keyword argument is only available if OpenCV is installed.
I hope I've been clear enough, don't hesitate to ask me questions if there is any information missing to solve my problem, thank you for taking time for me, I hope we will find a solution.我希望我已经足够清楚了,如果缺少任何信息来解决我的问题,请随时向我提问,感谢您抽出时间为我服务,我希望我们能找到解决方案。
Pip 安装 OpenCV 并在脚本中导入 OpenCV。
Its a known issue between OpenCV and Pyinstaller.它是 OpenCV 和 Pyinstaller 之间的一个已知问题。 For now you just need to install previous version of OpenCV 4.5.3.56现在你只需要安装以前版本的 OpenCV 4.5.3.56
pip install opencv-python==4.5.3.56
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.