一、找到合适的安装方式
pytorch官网:https://pytorch.org/
二、安装命令
pip --default-timeout=100 install torch torchvision -i https://pypi.tuna.tsinghua.edu.cn/simple
或者
conda install pytorch torchvision -c https://pypi.mirrors.ustc.edu.cn/simple
后面的是镜像,当然也可以采用其他源,网上很多,在这里不再陈述。或者用以下命令
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
conda config --set show_channel_urls yes
conda install pytorch==1.1.0 torchvision==0.3.0 cudatoolkit=9.0
三、卸载命令
pip uninstall torch