PyInstaller 打包后出现 opencv ImportError

1. 环境

系统: win11

Anaconda: 2021.11

Python: 3.9.12

Pyinstaller: 5.1

opencv-contrib-python: 4.6.0.66

2. 运行Pyinstaller 打包的exe后,会报以下错误

错误1:

ImportError: ERROR: recursion is detected during loading of "cv2" binary extentions. Check OpenCV installation.

解决办法:回退 opencv-contrib-python版本为 4.5.3.56

错误2:

ModuleNotFoundError: No module named 'cv2.cv2'

解决办法:删除打包指令中 --paths="D:Anaconda3\Lib\site-package\cv2"

你可能感兴趣的:(PyQt,opencv,python)