原因
pytorch版本与cuda版本不匹配,我想强调的是必须完全匹配上,比如你的cuda是9.0,则pytroch cuda版本也要9.0,不能9.1,9.2!
操作步骤
1.查看cuda版本,cmd中输入
nvcc -V
2.网站*https://pytorch.org/get-started/previous-versions/*中查找该cuda版本对应的pytorch版本
3.输入相应命令进行安装
(1)新建环境
conda create -n pytorch_gpu-cude9.0 python=3.7
(2)进入环境
activate pytorch_gpu-cude9.0
(3) 粘贴对应Pytorch版本
conda install pytorch==1.1.0 torchvision==0.3.0 cudatoolkit=9.0 -c pytorch
(4)安装成功后测试
更换cuda版本
安装了多个cuda,想要换版本参考如下方法:
https://blog.csdn.net/Timeloser_tong/article/details/123293000?spm=1001.2014.3001.5506