Centos7 安装 opencv
CentOS Linux release 7.2.1511 (Core)
1.安装依赖
yum makecache
yum -y install ffmpeg-devel
yum -y install gcc gcc-c++ cmake
yum -y install python-devel numpy
yum install gtk2-devel
yum -y install libgtk2
yum -y install libgtk2-devel
yum install libdc1394-devel
yum install libv4l-devel
yum install gstreamer-plugins-base-devel
2.安装opencv
yum -y install zip unzip
unzip 3.4.1.zip
cd opencv-3.4.1/
mkdir release
cd release/
cmake -D WITH_TBB=ON -D WITH_EIGEN=ON ..
cmake -D BUILD_DOCS=ON -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_EXAMPLES=OFF ..
cmake -D WITH_OPENCL=OFF -D WITH_CUDA=OFF -D BUILD_opencv_gpu=OFF -D BUILD_opencv_gpuarithm=OFF -D BUILD_opencv_gpubgsegm=OFF -D BUILD_opencv_gpucodec=OFF -D BUILD_opencv_gpufeatures2d=OFF -D BUILD_opencv_gpufilters=OFF -D BUILD_opencv_gpuimgproc=OFF -D BUILD_opencv_gpulegacy=OFF -D BUILD_opencv_gpuoptflow=OFF -D BUILD_opencv_gpustereo=OFF -D BUILD_opencv_gpuwarping=OFF ..
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
make
make install
opencv_version
ls /usr/local/lib/python2.7/site-packages/cv2.so
cp /usr/local/lib/python2.7/site-packages/cv2.so /usr/lib/python2.7/site-packages/
python
import cv2
遇到问题:
库文件找不到
vim /etc/ld.so.conf #添加
/usr/local/lib64
/usr/local/lib
ldconfig #刷新即可