Before packaging, it was OK. After upgrading pyinstaller and opencv, an error will be reported. I looked up a circle of information and found the answer on GitHub.
ImportError: OpenCV loader: missing configuration file: [‘config.py’]. Check OpenCV installation.
opencv Python 188.8.131.52
encountered a problem
Reduce the opencv Python version to 184.108.40.206. This small version iteration actually changed something, resulting in packaging failure.
PS: I tried this method several times and failed
import cv2 print(cv2.__file__)
Execute these two sentences to find the path where CV2 is located:
D:\anaconda\64\lib\site-packages\cv2\cv2.cp38-win_ AMD64. PYD
this is my path
pyinstaller -F -w --key '12345678' --clean main.py --paths="D:\anaconda\64\lib\site-packages\cv2"
Remove the last file name from the path and keep the whole folder.
I suggest using the second scheme, because it is not constrained by the version, and this problem can be solved in a similar way in other packages in the future.
- How to Solve PyInstaller Package Error: ModuleNotFoundError: No module named ‘xxxx‘
- [Solved] Pyinstaller Error: “RuntimeError: No metadata path found for distribution ‘greenlet‘
- [Solved] Pyinstaller packaged exe error: “failed to execute script XXX”
- Install PyTorch in Anaconda environment
- Error in sitecustomize set PYTHONVERBOSE for traceback KeyError: ‘PYTHONPATH’
- [Mac Pro M1] Python3.9 import cv2 Error: Reason: image not found
- [How to Solve] pyinstaller failed to execute script
- Python PIP TypeError: expected str, bytes or os.PathLike object, not int
- How to Solve Python Importerror: DLL load failed: unable to find the specified program using tensorflow
- [Python] error in installing jupyter: defaulting to user installation because normal Requirement already satisfied
- [Solved] PyInstaller Error: ValueError: too many values to unpack
- [Solved] Python matplotlib Error: RuntimeError: In set_size: Could not set the fontsize…
- NameError: name “defaultParams“ is not defined [How to Solve]
- [Solved] opencv-python: recipe for target ‘modules/python3/CMakeFiles/opencv_python3.dir/all‘ failed
- Importerror: DLL load failed: unable to find the specified module in Python
- [Solved] Pdfplumber Read PDF Sheet Error: AttributeError: function/symbol ‘ARC4_stream_init‘ not found in library
- Python2.7 Pyinstaller Install Error: ERROR: Command errored out with exit status 1
- Python Fatal error: Py_Initialize: unable to load the file system codec
- Mac Upgrade pip Error OSError: [Errno 13] Permission denied: ‘/Library/Python/2.7/site-packages/pip-9.0.1-py2….
- [How to Solve] ImportError: No module named typing