简体   繁体   English

在Ubuntu上安装Python的Opencv

[英]Opencv With Python Installation On Ubuntu

Recently I have been trying to install OpenCV on my computer. 最近,我一直在尝试在计算机上安装OpenCV。 First I started out by trying to install on Windows. 首先,我首先尝试在Windows上安装。 I tried a number of tutorials and kept at it for a while until I gave up. 我尝试了许多教程,并坚持了一段时间,直到我放弃。 A few people on the forums said that they did the same process I had done on Windows in Ubuntu Linux. 论坛上的一些人说,他们所做的过程与在Ubuntu Linux中的Windows上所做的过程相同。 Now, I have installed Ubuntu and followed this tutorial. 现在,我已经安装了Ubuntu,并遵循了教程。 Everything in the tutorial worked well until I ran the find_game.py script and got this error message: 在我运行find_game.py脚本并收到以下错误消息之前,本教程中的所有内容均正常运行:

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 "find_game.py", line 24, in cv2.imshow("Image", image) cv2.error: /io/opencv/modules/highgui/src/window.cpp:583: error: (-2) The function is not implemented. OpenCV错误:未指定错误(未实现该功能。使用Windows,GTK + 2.x或Carbon支持重建库。如果您使用的是Ubuntu或Debian,请安装libgtk2.0-dev和pkg-config,然后重新运行cmake或配置脚本)在cvShowImage中,文件/io/opencv/modules/highgui/src/window.cpp,第583行回溯(最近一次调用为最后):文件“ find_game.py”,第24行,在cv2.imshow(“图像” “,图像)cv2.error:/io/opencv/modules/highgui/src/window.cpp:583:错误:(-2)该功能未实现。 Rebuild the library with Windows, GTK+ 2.x or Carbon support. 在Windows,GTK + 2.x或Carbon支持下重建库。 If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function cvShowImage. 如果您使用的是Ubuntu或Debian,请安装libgtk2.0-dev和pkg-config,然后重新运行cmake或在函数cvShowImage中配置脚本。

I have searched every forum and at every one I get some variation of the answer "reload OpenCV with cmake". 我搜索了每个论坛,每个论坛我得到的答案都是“用cmake重新加载OpenCV”。 I have tried to reload OpenCV many times with cmake but every time the same error message pops up. 我试图用cmake重新加载OpenCV很多次,但是每次弹出相同的错误消息时。 I might have not installed the opencv_contrib libraries correctly, but I know I did follow every step from the tutorial. 我可能没有正确安装opencv_contrib库,但是我知道我确实按照教程中的每个步骤进行操作。 If anyone has any idea of what I should do it would be a big help. 如果有人对我应该做什么有任何想法,那将是一个很大的帮助。

I resolved my issue. 我解决了我的问题。 I found out that I had only installed opencv to work with python 2.7 and every time I would only type in python find_game.py . 我发现我只安装了opencv以与python 2.7一起使用,并且每次我只键入python find_game.py I figured out that when I did this it used the latest version(ie python 3.5) instead of python 2.7 so it wasn't compatible. 我发现当我这样做时,它使用的是最新版本(即python 3.5)而不是python 2.7,因此它不兼容。 I easily fixed this by instead doing python2.7 find_game.py . 我可以轻松地通过改为python2.7 find_game.py来解决此python2.7 find_game.py

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM