Ubuntu Anaconda3搭建OpenCV3环境(安装说明)

  • 安装Anaconda3

  • 下载安装包:https://repo.anaconda.com/archive/(Anaconda3+Python3.7)

  • 安装:sudo sh Anaconda3-2020.02-Linux-x86_64.sh

  • 查看版本:conda-V

  • 创建虚拟环境

  • 查看软件包信息:conda list (可直接使用python --version)

  • 查看虚拟环境信息:conda info --envs

  • 创建env_cv环境:conda create -n env_cv python=3.6(指定Python版本)

  • 开启环境:conda activate env_cv

  • 关闭环境:conda deactivate

  • 安装OpenCV

  • 开启虚拟环境:conda activate env_cv

  • 下载对应opencv3+python3.6:https://anaconda.org/menpo/opencv3/files

  • 安装opencv:conda install opencv3-3.1.0-py36_0.tar.bz2

  • 安装numpy:conda install -f numpy

  • 安装依赖

sudo apt-get install build-essential
sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libdc1394-22-dev # 处理图像所需的包
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev liblapacke-dev
sudo apt-get install libxvidcore-dev libx264-dev # 处理视频所需的包
sudo apt-get install libatlas-base-dev gfortran # 优化opencv功能
sudo apt-get install ffmpeg
sudo apt-get install libjasper-dev
  • 更换conda清华源

  • 首次生成.condarc:conda config(在/home/user文件夹中)

  • 链接:https://mirror.tuna.tsinghua.edu.cn/help/anaconda/

channels:
  - defaults
show_channel_urls: true
channel_alias: https://mirrors.tuna.tsinghua.edu.cn/anaconda
default_channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
  conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
conda config --set show_channel_urls yes
  • 换回默认源
conda config --remove-key channels
conda config
  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值