您的位置:首页 > 运维架构

Ubuntu 16.04编译安装最新的OpenCV3.2

2017-11-01 19:38 1071 查看
获取源代码

Shell

$ git clone https://github.com/opencv/opencv.git
1

$
git clone https://github.com/opencv/opencv.git
安装依赖库

Shell

#借助系统自带的opencv简化依赖安装步骤
$ sudo apt-get install libopencv-dev

1
2

#借助系统自带的opencv简化依赖安装步骤

$ sudo
apt-get
install libopencv-dev

编译源代码

Shell

$ cd opencv

$ mkdir build

$ cd build

$ cmake ..

$ make -j 10

1
2
3
4
5
6
7
8
9

$
cd opencv

 
$
mkdir build

 
$
cd build

 
$
cmake ..

 
$
make -j
10

替换已经安装的版本

Shell

$ sudo make install

1

$
sudo make
install

编译出错的处理
如果执行cmake时候出现如下错误信息

Shell

CMake Error at CMakeLists.txt:11 (message):

FATAL: In-source builds are not allowed.

You should create separate directory for build files.

-- Configuring incomplete, errors occurred!

1
2
3
4
5
6
7
8
9
10

CMake
Error at
CMakeLists.txt:11
(message):

  
 

  FATAL:
In-source
builds are not
allowed.
 

         You should
create separate
directory for
build files.
 

 
 

-- Configuring
incomplete,
errors occurred!

则应该是在代码根目录下直接执行过cmake,导致根目录下生成了CMakeCache.txt,需要删除CMakeCache.txt再次执行编译即可。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: