【发布时间】:2018-01-21 21:00:18
【问题描述】:
在 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)
【问题讨论】:
-
如果您通过 Python PIP,it's well known that the Python wrappers are not compiled with GTK support 安装了 OpenCV,那么您将无法在屏幕上显示图像,因此会出现这些错误。您唯一的选择是编译源代码以生成正确的 Python 包,以便您可以显示图像。 PyImageSearch 中的这些指示非常好:pyimagesearch.com/2015/07/20/…。准备好花费 30 分钟到一个小时,具体取决于您的系统配置和设置。
-
感谢它现在完成了。