# !/usr/bin/env python3
#decoding:utf-8
import time
import cv2
print(cv2.__version__)
time.sleep(10)
linux系统打包以上python代码,执行可执行文件报错:
Traceback (most recent call last):
File "test_04.py", line 6, in <module>
import cv2
File "/home/pi/.local/lib/python3.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 623, in exec_module
exec(bytecode, module.__dict__)
File "cv2/__init__.py", line 89, in <module>
File "cv2/__init__.py", line 58, in bootstrap
File "cv2/__init__.py", line 56, in load_first_config
ImportError: OpenCV loader: missing configuration file: ['config.py']. Check OpenCV installation.
[4762] Failed to execute script test_04
解决:
pip3 install --upgrade opencv-python
然后重新打包后,问题解决。