Ubuntu16.04安装openCV的问题集合
Q1
下列软件包有未满足的依赖关系:
libtiff4-dev : 依赖: libjpeg-dev
E: 无法修正错误,因为您要求某些软件包保持现状,就是它们破坏了软件包间的依赖关系。
上网查了下主要是因为版本的问题。
安装新的时必然要卸载旧的,但卸载的时候可能安装下一个包又需要这个包,所以产生了依赖(个人理解,不知到对了没)
纠结了很久突然发现每次出现这个问题的时候,都是在同时安装很多包的情况下发生的,如这一次的安装命令是
sudo apt-get install build-essential libgtk2.0-dev libjpeg62-dev libtiff4-dev libjasper-dev
libopenexr-dev cmake python-dev python-numpy libtbb-dev
libeigen2-dev yasm libfaac-dev libopencore-amrnb-dev libopencore-amrwb-dev
libtheora-dev libvorbis-dev libxvidcore-dev
于是我就把上面的命令分解成一个一个包安装,于是就发现成功了。因为这样安装他会重新卸载一些。
Q2:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package libtiff4-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
libtiff5-dev:i386 libtiff5-dev
E: Package 'libtiff4-dev' has no installation candidate
------------------
solution1
安装libtiff5-dev就行
solution2 换源更新 [我没找到合适的源]
sudo apt-get update
Q3:CMAKE下载的opencv的时候,下载的ippicv_linux_20151201.tgz文件hash码不匹配
file DOWNLOAD HASH mismatch
solution
- 编译时候加
-DWITH_IPP=OFF 这个选项
- 手动下载
ippicv_linux_20151201.tgz
PS:对于1,如果实时处理在您的项目中不是关键,或者其性能足够,您可以安全地禁用它。
PS:对于2
1.正常下载opencv3.1 [视觉slam14讲书上挂掉了,新的链接:http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/3.1.0/opencv-3.1.0.zip]
2.下载 ippicv_linux_20151201 https://raw.githubusercontent.com/Itseez/opencv_3rdparty/81a676001ca8075ada498583e4166079e5744668/ippicv/ippicv_linux_20151201.tgz
解压opencv3.1并进入其目录,运行下面的命令
ipp_file=../ippicv_linux_20151201.tgz ipp_hash=$(md5sum $ipp_file | cut -d" " -f1) ipp_dir=3rdparty/ippicv/downloads/linux-$ipp_hash mkdir -p $ipp_dir && cp $ipp_file $ipp_dir
3.编译和安装opencv
mkdir build cd build cmake ../../opencv-3.1.0 make sudo make install