OpenCV 4.12.0 出现cv2 error错误
错误代码如下:
cv2.error: OpenCV(4.12.0) D:aopencv-pythonopencv-pythonopencvmoduleshighguisrcwindow.cpp:1301: 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'
原因:
OpenCV 4.12.0 默认关闭了cv2的一些函数,两种办法 一种是修改配置。另外一种换成4.11版本
以下是卸载旧的扩展安装新的版本
pip uninstall opencv-python
pip uninstall opencv-contrib-python
安装opencv4.11
pip install -i https://mirrors.aliyun.com/pypi/simple/ opencv-python==4.11.0.86
pip install -i https://mirrors.aliyun.com/pypi/simple/ opencv-contrib-python==4.11.0.86