由于官方源下载速度太慢,所以切换清华镜像是很常见的conda安装方式,命令行中直接使用以下命令:
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 --set show_channel_urls yes
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
# for legacy win-64
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/peterjc123
有时候国内镜像源无法连接,需要恢复原来的源:
conda config --remove-key channels
版本选择,我的选择如图,建议不要选择太新的版本,很可能导致程序出错,又需要降回低版本
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple torch==1.4.0+cu92 torchvision==0.5.0+cu92 -f https://download.pytorch.org/whl/torch_stable.html
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple torch==1.2.0+cu92 torchvision==0.5.0+cu92 -f https://download.pytorch.org/whl/torch_stable.html
多试几次,有时候会突然从40k/s飙到1.4M/s,太慢就直接断开重新开始
命令行验证pytorch是否正常安装成功,可以正常打印出版本号就表明安装没问题。
import torch
print(torch.__version__)
注意选择之前安装pytorch时的对应版本
选择对应的操作系统
命令行中通过nvcc -V检查CUDA安装情况
点击此处直达官网 需要注册账号才能下载
还是需要注意对应pytorch版本
解压后覆盖CUDA安装目录的对应文件夹
主要参考:
https://blog.csdn.net/Mind_programmonkey/article/details/99688839
https://blog.csdn.net/jer8888/article/details/100558964
win10笔记本安装PyTorchGPU+CUDA+cuDNN
原文:https://www.cnblogs.com/lqchen/p/12341823.html