python的opencv错误The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon

1、出现问题:

cv2.error: OpenCV(4.5.4-dev) D:\a\opencv-python\opencv-python\opencv\modules\highgui\src\window.cpp:1274: error: (-2:Unspecified e
rror) 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'

2、原因分析:

1、安装包问题,需要安装以下安装包

python的opencv错误The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon

 

2、路径问题 ,相对路径和绝对路径都可以,参考如下:image=cv2.imread("D:\\01xiangmu\\43tesseract\\IMG\\01.png") 

以上均没问题,一看网上面均说的是这两种情况,均无法解决笔者问题,搞得笔者直接怀疑是不是安装包有问题,直接想下载源码编译,仍无法正常运行,笔者遇到了最棘手的问题,最后竟然发现是安装包冲突问题:

3、安装包冲突问题

python的opencv错误The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon

python的opencv错误The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon

笔者原先有opencv包,没有卸载干净,就安装opencv-contrib-python包和opencv-contrib-python-headless包,可能导致python识别错误,导致无法正常识别运行,出现上述问题。

但是笔者的opencv包竟然无法正常卸载,无论通过Pycham或者Anaconda环境房间pip uninstall、conda uninstall、conda remove 均无法卸载。。。。

最后直接到C:\ProgramData\Anaconda3\envs\pytorch中查找opencv,发现无法卸载,conda list却显示opencv的原因是C:\ProgramData\Anaconda3\envs\pytorch\conda-meta中的opencv残留,如下:

python的opencv错误The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon

将其手动删除,conda list,发现已经不存在opencv。

python的opencv错误The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon

同时,将base环境下的opencv包删除,直接搜索

 

python的opencv错误The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon

删除干净后,再次安装

 python的opencv错误The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon

 然后pycham运行程序,

python的opencv错误The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon

终于正常运行!

 

 

 

 

 

 

文章出处登录后可见!

已经登录?立即刷新

共计人评分,平均

到目前为止还没有投票!成为第一位评论此文章。

(0)
心中带点小风骚的头像心中带点小风骚普通用户
上一篇 2023年2月26日 上午11:29
下一篇 2023年2月26日 上午11:30

相关推荐