首先需要新建虚拟环境
conda create –n your_name python=3.6
//这里的yourname是虚拟环境的名字,取什么都可以
激活环境
activate your_name
添加清华镜像源
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 --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/peterjc123/
conda config --set show_channel_urls yes
安装代码
去官网找安装代码 https://pytorch.org/get-started/previous-versions/
我的是cuda10.0 只能够装到1.2.0版本的pytorch, 输入安装代码 (把-c pytorch删掉)
//官网的代码
//conda install pytorch==1.2.0 torchvision==0.4.0 cudatoolkit=10.0 -c pytorch
我们要输入的代码
conda install pytorch==1.2.0 torchvision==0.4.0 cudatoolkit=10.0