问题描述,程序中含有cv2库,使用pyinstaller打包成exe后,执行出现闪退,并且报错没导入cv2库,百度得知是cv2版本太高
报错代码:
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.
[15648] Failed to execute script '调用摄像头' due to unhandled exception!
raise ImportError('ERROR: recursion is detected during loading of "cv2" bina
执行下列操作,重新安装低版本cv2后,问题解决
pip uninstall opencv-python
pip install opencv-python==4.5.1.48
Python程序打包成exe
pip install pyinstaller #安装打包程序
pyinstaller -F 要打包的python程序
重新打包后程序正常执行