Linux环境下的detectron2环境配置

先创建虚拟环境

conda create -n detect2 python=3.9    #查看python版本号的命令   python --version

添加镜像

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/

conda config --show channels  #这个命令是检测镜像是否添加成功

在创建的虚拟环境下安装相应版本的pytorch,注意看自己CUDA的版本号。这一步与下一步同时进行,

CUDA 10.2
conda install pytorch==1.10.0 torchvision==0.11.0 torchaudio==0.10.0 cudatoolkit=10.2CUDA 11.3
conda install pytorch==1.11.0 torchvision==0.12.0 torchaudio==0.11.0 cudatoolkit=11.3

根据官方网站Installation — detectron2 0.6 documentation来选择合适的版本,这里我的CUDA版本是11.3,所有我安装的是pytorch版本是1.10

Linux环境下的detectron2环境配置_第1张图片

 python -m pip install detectron2 -f \ https://dl.fbaipublicfiles.com/detectron2/wheels/cu113/torch1.10/index.html

下一步就是安装一些漏掉的安装包

pip install opencv-python

###下面是常会出现的问题,就是setuptools版本过高而导致的错误

pip uninstall setuptools pip install setuptools==59.5.0

你可能感兴趣的:(Pytorch深度学习,python,linux,pytorch,python)