So I am trying to convert my python project to an exe file and run it, but when I do, I get an error like this:
Failed to execute script ‘My project’ due to unhandled exception: ERROR recursion is detected during loading of “cv2” binary extensions. Check OpenCV installation.
JavaScript
x
8
1
Traceback (most recent call last):
2
File "Myproject.py", line 3, in module
3
File "PyInstallerloaderpyimod03_importers.py", line 476, in exec_module
4
File "cv2__init__.py", line 180, in module
5
File "cv2__init__.py", line 75, in bootstrap
6
ImportError:
7
ERROR: recursion is detected during loading of "cv2" binary extensions. Check OpenCV installation.
8
Here’s some of the code:
JavaScript
1
27
27
1
import pyautogui as pg
2
from time import sleep
3
import cv2
4
5
6
sleep(1)
7
8
pg.hotkey('super', 's')
9
10
sleep(0.2)
11
pg.typewrite('chrome')
12
13
sleep(0.3)
14
15
pg.press('enter')
16
17
sleep(0.4)
18
19
pg.typewrite('youtube.com')
20
pg.press('enter')
21
sleep(1)
22
23
cords = pg.locateCenterOnScreen('search.png', confidence=0.8)
24
pg.click(cords)
25
pg.typewrite('a random video')
26
pg.press('enter')
27
any help would be appreciated.
Advertisement
Answer
Just found out the problem.I was using the latest 3.10.0 version of Python and apparently, it had some bugs about numpy and opencv modules.
My Advice:
Never use the latest python version. Always the previous one.