openCV 不适用于 python3

苏拉兹内吉

在 ubuntu 16.10 上运行带有 opencv 程序的简单 Python3 时出现此错误。

OpenCV 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
/io/opencv/modules/highgui/src/window.cpp, line 583 Traceback (most
recent call last):   File "samplecv.py", line 3, in <module>
    cv2.imshow('image',img) cv2.error: /io/opencv/modules/highgui/src/window.cpp:583: 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

我运行的程序是:

  import cv2
    img = cv2.imread('my.jpg',0)
    cv2.imshow('image',img)

我已经检查过类似的问题thisthis并重新安装了opencv,但没有帮助。

苏拉兹内吉

花了2个多小时,但现在完成了!我去了opencv的这个文档,并按照步骤安装了opencv 3.3.0-dev。完成安装后,它仍然无法正常工作,所以我卸载了 opencv-python 使用

sudo pip3 uninstall opencv-python

现在错误没有出现,但在我添加之前图像仍然没有显示

cv2.waitKey()

在程序结束时。现在它工作正常!!!

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章