openCV不适用于python3 [英] openCV not working with python3

查看:175
本文介绍了openCV不适用于python3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am getting this error while running a simple Python3 with opencv program on ubuntu 16.10.

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)

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

I have already checked similar questions this and this. And have re-installed opencv but it didnt help.

推荐答案

花费了两个多小时,但现在完成了! 我去了 opencv的文档然后执行安装opencv 3.3.0-dev的步骤. 完全安装后,它仍然无法正常工作,因此我使用

It took more than 2 hours but its done now! I went to this documentation of opencv and followed the step to install opencv 3.3.0-dev. After complete installation it was still not working so i uninstalled the opencv-python using

sudo pip3 uninstall opencv-python

现在没有出现错误,但是直到我添加图像仍然没有显示

cv2.waitKey()

在程序的末尾. 现在可以正常工作了!

at the end of the program. Now its working fine!!!

这篇关于openCV不适用于python3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆