Python OpenCV2报错解决办法

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/newmemory/article/details/86616651

Ubuntu 16.04运行Python OpenCV显示图片时报错,内容如下:

cv2.imshow(‘window’,image)
cv2.error: OpenCV(3.4.2) /tmp/build/80754af9/opencv-suite_1535558553474/work/modules/highgui/src/window.cpp:632: error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon 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’

可能是因为新版本不兼容问题,解决办法为在终端输入:

conda remove opencv
conda install -c menpo opencv
pip install --upgrade pip
pip install opencv-contrib-python (关键)

猜你喜欢

转载自blog.csdn.net/newmemory/article/details/86616651