Ubuntu16.04 使用Anaconda安装opencv后imshow失败

Ubuntu16.04系统,使用Anaconda的conda install安装opencv,安装完后import cv2没问题,但是执行cv2.imwrite("test.png", img) 和cv2.imshow("Img", img)时提示错误:

error:

(OpenCV 3.4.2)/tmp/build/80754af9/opencv_1512687413662/work/modules/highgui/src/window.cpp:611:
error: (-2) 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
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容