When writing Python today, I referenced CV2 when packaging with pyinstaller, and this error occurred:
ImportError: OpenCV loader: missing configuration file: ['config.py']. Check OpenCV installation.
Create a new Python file and get the path of OpenCV:
import cv2
print(cv2.__file__)
Here I get: C:\Anaconda3\lib\site-packages\cv2\__init__.py
After you reuse pyinstaller for packaging, add the paths parameter:
pyinstaller main.py -F --paths="C:\Anaconda3\lib\site-packages\cv2"
No error reported, successful operation!
Similar Posts:
- [Solved] Pyinstaller package Error: AttributeError: ‘str’ object has no attribute ‘decode’
- [Solved] ImportError: ERROR: recursion is detected during loading of “cv2” binary extensions. Check OpenCV installation.
- [Solved] Importerror: DLL load failed while importing mtrand: the specified program could not be found.
- [Solved] ModuleNotFoundError: No module named’usysconfigdata u x86 64-u-gnu’
- MAC OS Install opencv ModuleNotFoundError: No module named ‘cv2’
- [Solved] torch.cuda.CudaError: CUDA driver version is insufficient for CUDA runtime version (35) [ WARN:0
- Pyinstaller Package Error: failed to execute script main [How to Solve]
- [Solved] ImportError: cannot import name pywrap_tensorflow
- [Solved] “import numpy as np” ImportError: No module named numpy
- [Solved] Exception: Jupyter command `jupyter-notbook` not found.