-
安装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