OpenCV loader: missing configuration file: ['config.py']报错解决

pyinstaller 打包引用了 opencv 的程序时,出现了这个错误:

ImportError: OpenCV loader: missing configuration file: ['config.py']. Check OpenCV installation.

查阅了往上的方法大部分都说升级 pyinstaller 和 opencv 就可以解决:

pip install --upgrade opencv-pythonpip install --upgrade pyinstaller

可是我的库都是最新版本的,根本没得升级。找了很久终于找到了一个成功的解决方法:

1.新建一个 python 文件,获取 opencv 的路径:

import cv2print(cv2.__file__)

这里我得到的是 D:\work ools\Python\Python36\Lib\site-packages\cv2\__init__.py

2.在使用 pyinstaller 时,加入 paths 选项:

pyinstaller main.py -F --paths="D:\work	ools\Python\Python36\Lib\site-packages\cv2"

到这里,报错成功就解决啦~~~

发表评论
留言与评论(共有 0 条评论) “”
   
验证码:

相关文章

推荐文章