赞
踩
在使用opencv中的cv2.imshow显示图片的时候总会出现如下错误:cv2.error: OpenCV(4.8.1) D:\a\opencv-python\opencv-python\opencv\modules\highgui\src\window.cpp:1272: error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Cocoa support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function 'cvShowImage'
1:查找了很多资料发现是在安装opencv的时候安装顺序出现了问题,于是执行下面代码,重新安装imshow就能成功显示图片了
- pip uninstall opencv-python
- pip uninstall opencv-contrib-python
-
- pip install opencv-contrib-python
- pip install opencv-python
二:模块冲突,卸载opencv-contrib-python,查看以下几种包之间依赖
大概率解决问题。
- opencv-python: 只包含opencv库的主要模块. 一般不推荐安装.
- opencv-contrib-python: 包含主要模块和contrib模块, 功能基本完整, 推荐安装.
- opencv-python-headless: 和opencv-python一样, 但是没有GUI功能, 无外设系统可用.
- opencv-contrib-python-headless: 和opencv-contrib-python一样但是没有GUI功能. 无外设系统可用
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。