I have a small program which return opencv error after compilation by pyinstaller. But without compilation it's work!
I use Python 3.8.10 on Windows 10
Program:
import pyautogui
import numpy as np
import cv2
try:
from PIL import Image
except ImportError:
import Image
screenshot = pyautogui.screenshot('screenshot.png', region=(970, 591, 184, 101)) # start
img = cv2.imread('screenshot.png')
img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
img = cv2.bitwise_not(img)
Error:
['C:\Users\n1kro\AppData\Local\Temp\_MEI83642\base_library.zip', 'C:\Users\n1kro\AppData\Local\Temp\MEI83642\lib-dynload', 'C:\Users\n1kro\AppData\Local\Temp\MEI83642']
Traceback (most recent call last):
File "test.py", line 3, in
File "PyInstaller\loader\pyimod03_importers.py", line 476, in exec_module
File "cv2_init.py", line 180, in
File "cv2_init.py", line 75, in bootstrap
ImportError: ERROR: recursion is detected during loading of "cv2" binary extensions. Check OpenCV installation. [3416] Failed to execute script 'test' due to unhandled exception!
I tried to reinstall all, but it is not helped!
Find this post: https://github.com/opencv/opencv/issues/13202 But dont understand, what to do :( Need your help, please!