1.创建conda虚拟环境conda create -n pt python=3.6
2.设置开启的默认虚拟环境
2.1 sudo gedit ~/.bashrc
2.2 source ~/.bashrc
3.修改conda的镜像
3.1 sudo gedit /.condarc
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/cloud/conda-forge
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
- defaults
show_channel_urls: true
channel_priority: flexible
4 安装pytorch
conda install pytorch==1.6.0 torchvision==0.7.0 (不要加 -c pytorch)