欢迎光临
我们一直在努力

CentOS6.5上配置Python2.7+OpenCV2.4.13

为了学习使用Faster R-CNN,需要安装OpenCV +python环境,之前已经在centos下安装好了python2.7。yum安装的opencv是2.0版本,安装了opencv-python,但python中import cv2仍会报错,无法满足需要。所以决定用编译方式安装opencv。

CentOS6.5下安装python2.7参见《CentOS6.5下为编译Caffe升级python2.6.6到2.7》

下载opencv源码

从opencv的官网下载opendv2.4.13源码:
https://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.13/opencv-2.4.13.zip/download

编译安装opencv

#!/bin/sh
unzip opencv-2.4.13.zip
cd opencv-2.4.13
mkdir build && cd build
# 执行cmake生成Makefile
cmake -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/g++ -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/gcc -DWITH_IPP=OFF -DWITH_OPENCL=OFF -DWITH_GTK_2_X=ON -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/usr/local ..
# 开始编译 24线程
make -j24
sudo make install

测试opencv-python

赞(0) 打赏
未经允许不得转载:九八云安全 » CentOS6.5上配置Python2.7+OpenCV2.4.13

评论 抢沙发