(Ubuntu 14.04)apt-get libopencv-dev,但是得到错误:无法纠正问题,你已经破坏了包裹

时间:2015-02-11 12:45:05

标签: c++ opencv ubuntu apt-get

阅读包裹清单......完成 建立依赖树
阅读国家信息......完成 某些软件包无法安装。这可能意味着你有 请求一个不可能的情况或如果您使用不稳定 尚未创建某些必需包的分发 或被移出Incoming。 以下信息可能有助于解决问题:

The following packages have unmet dependencies:
 libopencv-dev : Depends: libopencv-objdetect-dev (= 2.4.8+dfsg1-2ubuntu1) but it is not going to be installed
                 Depends: libopencv-highgui-dev (= 2.4.8+dfsg1-2ubuntu1) but it is not going to be installed
                 Depends: libopencv-legacy-dev (= 2.4.8+dfsg1-2ubuntu1) but it is not going to be installed
                 Depends: libopencv-contrib-dev (= 2.4.8+dfsg1-2ubuntu1) but it is not going to be installed
                 Depends: libopencv-videostab-dev (= 2.4.8+dfsg1-2ubuntu1) but it is not going to be installed
                 Depends: libopencv-superres-dev (= 2.4.8+dfsg1-2ubuntu1) but it is not going to be installed
                 Depends: libopencv-ocl-dev (= 2.4.8+dfsg1-2ubuntu1) but it is not going to be installed
                 Depends: libcv-dev (= 2.4.8+dfsg1-2ubuntu1) but it is not going to be installed
                 Depends: libhighgui-dev (= 2.4.8+dfsg1-2ubuntu1) but it is not going to be installed
                 Depends: libcvaux-dev (= 2.4.8+dfsg1-2ubuntu1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

另外,我使用了" aptitude install libopencv-dev",但它没有用。所以我不知道如何解决这个问题。

2 个答案:

答案 0 :(得分:8)

官方回购中的包裹已过时,不能使用它们。这是我用来安装OpenCV的,也适用于你。

sudo apt-get install build-essential make cmake git libgtk2.0-dev pkg-config python python-dev python-numpy libavcodec-dev libavformat-dev libswscale-dev libjpeg-dev libpng-dev libtiff-dev
cd ~/Downloads
git clone https://github.com/itseez/opencv
mv opencv /opt
cd /opt/opencv
git checkout 2.4.10.1 #or whatever version you want
sudo mkdir build
cd build
sudo cmake -j4 -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
sudo make -j4
sudo make -j4 install
sudo ldconfig

请参阅此http://docs.opencv.org/doc/tutorials/introduction/linux_install/linux_install.html

答案 1 :(得分:0)

我需要OpenCV 3.2并且需要启用硬件加速模块,我在ubuntu 14.04.5上遵循了这个步骤:

  1. 下载所需的库:
  2. sudo apt-get install build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper -dev libdc1394-22-dev

    1. http://opencv.org/downloads.html

    2. 下载opencv
    3. 解压缩,在目录中执行cd并运行:

    4. mkdir build

      cd build

      cmake -D CMAKE_BUILD_TYPE = RELEASE -D CMAKE_INSTALL_PREFIX = / usr / local -D WITH_TBB = ON -D BUILD_NEW_PYTHON_SUPPORT = ON -D WITH_V4L = ON -D INSTALL_C_EXAMPLES = ON -D INSTALL_PYTHON_EXAMPLES = ON -D BUILD_EXAMPLES = ON -D WITH_QT = OFF -D WITH_OPENGL = ON -D WITH_OPENCL = ON -D WITH_VA_INTEL = ON -D BUILD_SHARED_LIBS = ON ..

      make -j8#并行运行8个不同的作业

      sudo make install

      添加行"导出LD_LIBRARY_PATH = / usr / local / lib /:$ LD_LIBRARY_PATH"到.bashrc文件

      sudo ldconfig

      希望它可以提供帮助