python+opencv 问题解决方案,OpenCV Error: Unspecified error (The function is not implemented. Rebuild the

系统Ubuntu 18.04 LTS

python 版本 Anaconda python3.6

采用conda install opencv后,调用opencv的函数时,出现错误:

 

OpenCV(3.4.1) Error: 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 cvShowImage, file /opt/conda/conda-bld/opencv-suite_1530789967746/work/modules/highgui/src/window.cpp, line 636
Traceback (most recent call last):
  File "drawing.py", line 9, in
    cv2.imshow("Canvas", canvas)
cv2.error: OpenCV(3.4.1) /opt/conda/conda-bld/opencv-suite_1530789967746/work/modules/highgui/src/window.cpp:636: 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

 

看过网上很多的方法,都没有效果。后来通过这篇博客,算是解决了我的问题:

https://blog.csdn.net/leviopku/article/details/79247236,感谢这位楼主!

具体就是通过这个命令来安装opencv:

conda install --channel https://conda.anaconda.org/menpo opencv3

 

然而,这里面还有一个问题是这样安装的版本是opencv3.1版本的,而我今天要用到的功能是opencv3.3以上版本才会有的。所以自己又折腾了一下,最后发现采用

pip install opencv-python

应该就可以安装好,由于我采用pip安装时候总是下载失败,我就去pip的官网去下载了。我把网址贴在这里

https://pypi.org/project/opencv-python/#files

从这里下载好自己对应版本的opencv,然后采用cd到相应目录,

pip install opencv_python-3.4.2.16-cp36-cp36m-manylinux1_x86_64.whl (我的版本) 就可以解决上述问题啦!

 

希望对有opencv高版本需求的小伙伴们有帮助!

 

你可能感兴趣的:(python+opencv 问题解决方案,OpenCV Error: Unspecified error (The function is not implemented. Rebuild the)