centos7 下离线安装 opencv

安装cmake步骤

//删除原有的低版本cmake,若版本够高则不需要重新安装cmake,也可以直接下好cmake.*.tar.gz
yum remove cmake -y && rm -f /usr/bin/cmake

wget https://cmake.org/files/v3.6/cmake-3.6.2.tar.gz    
tar xvf cmake-3.6.2.tar.gz && cd cmake-3.6.2/
./bootstrap

gmake
gmake install

ln -s /usr/local/bin/cmake /usr/bin/

安装opencv

如果g++不存在先安装g++
yum install gcc gcc-c++

先下载号离线opencv压缩包
.解压opencv4.1.2.zip

cd opencv4.1.2

mkdir build

cd build

cmake3 -D BUILD_SHARED_LIBS=ON -D BUILD_TESTS=OFF -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local/opencv/ ..
make
make install

配置opencv环境
cd /usr/local/opencv
cp -r include /usr/local/
cd /usr/local/opencv/lib64
cp libopencv* /usr/local/lib64 
vim /etc/ld.so.conf      (增加: /usr/local/lib64    /usr/local/lib )    
source /etc/profile

你可能感兴趣的:(opencv,linux,centos,cmake)