Python Ubuntu 17.04 中的 OpenCV

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/43484357/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 23:07:55  来源:igfitidea点击:

OpenCV in Ubuntu 17.04

pythonopencvubuntu

提问by mjm

I had OpenCVinstalled in my Ubuntumachine running Ubuntu 16.10. Recently I updated to the latest Ubuntu 17.04and OpenCVfailed to work.

我已经OpenCV安装在我的Ubuntu机器上运行Ubuntu 16.10。最近我更新到最新的Ubuntu 17.04OpenCV失败了。

I am getting the following error.

我收到以下错误。

ImportError: libjasper.so.1: cannot open shared object file: No such file or directory

I tried to install libjasper. With the command sudo apt-get install libjasper-dev

我尝试安装libjasper. 随着命令sudo apt-get install libjasper-dev

But I am getting the error E: Unable to locate package libjasper-dev

但我收到错误 E: Unable to locate package libjasper-dev

How can I fix it ?

我该如何解决?

回答by headdab

I found the answer here: https://github.com/opencv/opencv/issues/8622

我在这里找到了答案:https: //github.com/opencv/opencv/issues/8622

sudo add-apt-repository "deb http://security.ubuntu.com/ubuntu xenial-security main"
sudo apt update
sudo apt install libjasper1 libjasper-dev

References to 17.04 packages no longer work.

对 17.04 软件包的引用不再有效。

回答by mjm

Installing the opencvlibrary from the repository worked for me. Just both the following commands.

opencv从存储库安装库对我有用。只需以下两个命令。

sudo apt-get install opencv-data 
sudo apt-get install libopencv-dev 

After installing that it worked as before. Previously I had build opencvmyself. The one from the repository will work apparantely.

安装后它像以前一样工作。以前我已经建立了opencv自己。存储库中的一个将正常工作。

回答by chittychitty

libjasper-dev is not available for Ubuntu 17.04.

libjasper-dev 不适用于 Ubuntu 17.04。

So you need to install the package from an earlier release. Try the following:

因此,您需要安装早期版本的软件包。请尝试以下操作:

echo "deb http://us.archive.ubuntu.com/ubuntu/ yakkety universe" | sudo tee -a /etc/apt/sources.list

This will add a new line to the sources.list file in /etc/apt. It will allow installation of packages from 16.10.

这将在 /etc/apt 中的 sources.list 文件中添加一个新行。它将允许从 16.10 安装软件包。

You should be able to install the missing package libjasper-dev now with the following commands:

您现在应该可以使用以下命令安装缺少的软件包 libjasper-dev:

sudo apt-get update
sudo apt-get install libjasper-dev

回答by anh hoang vu

I had to download the new and updated, built version of opencv and success

我必须下载新的和更新的 opencv 构建版本并成功

回答by Libertar.io

Write this Down, it is really helpful,

写下来,真的很有帮助

echo "deb http://us.archive.ubuntu.com/ubuntu/ yakkety universe" | sudo tee -a /etc/apt/sources.list