如何安装OpenCV的依赖项?

如何安装OpenCV的依赖项?

我正在尝试按照以下说明安装 OpenCV:https://docs.opencv.org/2.4/doc/tutorials/introduction/linux_install/linux_install.html

当我跑步时:sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev

我收到此错误:

The following packages have unmet dependencies: 

libavcodec-dev : Depends: libavutil-dev (= 7:2.8.6-1ubuntu2) but it is not going to be installed 

                  Depends: libswresample-dev (= 7:2.8.6-1ubuntu2) but it is not going to be installed 

libavformat-dev : Depends: libavformat-ffmpeg56 (= 7:2.8.6-1ubuntu2) but 7:2.8.11-0ubuntu0.16.04.1 is to be installed 

                   Depends: libavutil-dev (= 7:2.8.6-1ubuntu2) but it is not going to be installed 

                   Depends: libswresample-dev (= 7:2.8.6-1ubuntu2) but it is not going to be installed 

libgtk2.0-dev : Depends: libgtk2.0-0 (= 2.24.30-1ubuntu1) but 2.24.30-1ubuntu1.16.04.2 is to be installed 

                 Depends: libglib2.0-dev (>= 2.27.3) but it is not going to be installed 

                 Depends: libgdk-pixbuf2.0-dev (>= 2.21.0) but it is not going to be installed 

                 Depends: libpango1.0-dev (>= 1.20) but it is not going to be installed 

                 Depends: libatk1.0-dev (>= 1.29.2) but it is not going to be installed 

                 Depends: libcairo2-dev (>= 1.6.4-6.1) but it is not going to be installed 

                 Depends: libxcursor-dev but it is not going to be installed 

                 Recommends: debhelper but it is not going to be installed 

libswscale-dev : Depends: libavutil-dev (= 7:2.8.6-1ubuntu2) but it is not going to be installed 

                  Depends: libswscale-ffmpeg3 (= 7:2.8.6-1ubuntu2) but 7:2.8.11-0ubuntu0.16.04.1 is to be installed 

E: Unable to correct problems, you have held broken packages. 

我已经分别用 Google 搜索了每个依赖项,但找不到任何有效的东西。

我正在使用 Ubuntu 16.04.3 LTS

答案1

我只是无法解决这个问题,所以我安装了Ubuntu 16.04(http://old-releases.ubuntu.com/releases/16.04.0/ubuntu-16.04-desktop-amd64.iso),并且我能够运行,sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev没有任何错误。

相关内容