pyinstaller package and run exe error: “recursion is detected during loading of “cv2“ binary extensions.”
Traceback (most recent call last): File "Sy.py", line 15, in File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module File "cv2\__init__.py", line 180, in bootstrap() File "cv2\__init__.py", line 152, in bootstrap native_module = importlib.import_module("cv2") File "importlib\__init__.py", line 126, in import_module File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module File "cv2\__init__.py", line 180, in bootstrap() File "cv2\__init__.py", line 75, in bootstrap raise ImportError('ERROR: recursion is detected during loading of "cv2" binary extensions. Check OpenCV installation.') ImportError: ERROR: recursion is detected during loading of "cv2" binary extensions. Check OpenCV installation.
Use pip to uninstall opencv, pip uninstall opencv ******* (the name of the specific opencv installation)
Go to the %:\python\Lib\site-packages% path (the path of the python installation) and delete the cv2 folder
Reinstall opencv with pip, pip install opencv****
Solution (you can try in sequence).
1. reinstall cv2. (This is the answer more, most cases useful)
first pip unintall opencv-python , then pip intall opencv-python
2. set the environment variables.
3. lower cv2 version.
There is a compatibility problem between pyinstaller and cv2 version. I use pyinstaller is 4.7 (python3.8.0), cv2 is 188.8.131.52, the result is an error, lower the cv2 version to 184.108.40.206 and then package, it does not report an error.
open cmd and use pip to install a different version:
pip install opencv-python==220.127.116.11
- Pyinstaller Package Error: ImportError: OpenCV loader: missing configuration file: [‘config.py‘]
- MAC OS Install opencv ModuleNotFoundError: No module named ‘cv2’
- Consider using the `–user` option or check the permissions.
- How to Solve Opencv error: assertion failed + error: (- 215)
- AttributeError: module ‘cv2’ has no attribute ‘SIFT’ [How to Solve]
- [Solved] Importerror: DLL load failed while importing mtrand: the specified program could not be found.
- [Solved] Lego-loam Error: opencv fatal error: cv.h: No such file or directory
- OpenCV Install Error: modulenotfounderror: no module named ‘cv2’
- modulenotfounderror: no module named ‘cv2’ [How to Solve]
- Opencv learning notes 05 face detection and recognition attributeerror: module ‘CV2’ has no attribute ‘face’