redhat安装opencv

参考网站

http://www.cnblogs.com/fesh/p/4110535.html

http://www.it1352.com/324364.html (python 问题解决)

http://stackoverflow.com/questions/18729495/installing-opencv-with-python-module-on-centos-goes-wrong/18733071#18733071 (python 问题解决)

http://www.jb51.net/os/RedHat/280309.html (依赖安装,cmake参数)

 

redhat安装opencv

一、直接cmake

问题:

  1. make[1]: *** [modules/python/CMakeFiles/opencv_python.dir/all] Error 2
  2. make[2]: *** [lib/cv2.so] Error 1
  3. libpython2.7.a(abstract.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC

解决:

You need to reinstall python with shared and static way.

Firstly, download Python source file again.

and then..

重新安装python

  1. tar xvf Python-2.7.12.tgz
  2. cd Python-2.7.12
  3. ./configure –shared-static
  4. make
  5. sudo Make install

二、安装依赖包

  1. yum install cmake gcc gcc-c++ gtk+-devel gimp-develgimp-devel-tools gimp-help-browser zlib-devel libtiff-devel libjpeg-devellibpng-devel gstreamer-devel libavc1394-devel libraw1394-devel libdc1394-develjasper-devel jasper-utils swig python libtool nasm

三、生成make文件并安装

  1. cd opencv2.3.1

CMake配置

  1. cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_NEW_PYTHON_SUPPORT=NO

  //这里可能提示line44错误。 进去Cmakelist.txt,把第44行注释掉

  // 注意NO后面为空格+. 必不可少。

Build files have been written to :/****表示cmake成功

编译

  1. make //编译,需要较长时间

[100%] Built target opencv_visualisation

编译成功

安装

  1. sudo make install

配置

  1. vim /etc/ld.so.conf.d/opencv.conf   //创建pkg-config配置文件

/usr/lib   //添加配置文件/usr/lib/pkgconfig/opencv.pc位置

或者是/usr/local/lib //位置一定要正确

转载于:https://www.cnblogs.com/yizhichun/p/6339763.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值