ubuntu16.04安装opencv(anaconda)

ubuntu16.04安装opencv(anaconda)

  • 安装opencv所需的依赖

     sudo apt-get update
      
     sudo apt-get upgrade
      
     sudo apt-get install build-essential cmake pkg-config libatlas-base-dev gfortran unzip
      
     sudo apt-get install python2.7-dev
      
     sudo apt install python-pip
      
     pip install numpy
    
  • 编译安装opencv

     wget https://github.com/opencv/opencv/archive/3.3.0.zip -O opencv-3.3.0.zip
      
     unzip opencv-3.3.0.zip
      
     cd opencv-3.3.0
      
     mkdir build && cd build
    

#这步中的CMAKE_INSTALL_PREFIX是安装路径,默认的可以是/usr/local,也可以像我一样装在个人目录下,PYTHON_EXECUTABLE是用到的python,可以在命令行中输入which python查看用到的是哪个python

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/home/xiongcx/anaconda2/envs/r21d -D PYTHON_EXECUTABLE=/home/xiongcx/anaconda2/envs/r21d/bin/python -D BUILD_EXAMPLES=ON -D BUILD_SHARED_LIBS=ON ..
	make -j20

#如果前面CMAKE_INSTALL_PREFIX选择的是/usr/local,这里需改为sudo make install
make install
4、验证安装是否成功

 python
>>> import cv2
>>> cv2.__version__
'3.4.0'
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值