潇洒郎: Cuda9.0 100%安装pytorch 成功
显卡驱动版本决定cuda版本,cuda版本决定cudnn版本与pytorch版本
驱动版本390.65,——cuda90——cudnn90——pytorch
版本有一个对不上,torch.cuda.is_available() 都是False
Cuda9.0 搭配 pytorch1.1.0 torchvision0.3.0 torchaudio不用
下载whl文件直接pip install 安装即可
1、查看自己显卡驱动版本
C:\Program Files\NVIDIA Corporation\NVSMI>nvidia-smi
NVIDIA-SMI 390.65 DRIVER VERSION:390.65
则显卡支持cuda9.0
下载cuda9.0
进入https://developer.nvidia.com/cuda-downloads,选择对应的系统配置下载cuda.xxxxxx.exe文件。
点击安装,记住安装的位置(下载后的cudnn压缩包内容复制进去,该文件为了计算卷积)
安装完成cudatookit后,可以看到
在清华源下载https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud//pytorch/win-64/
在清华源下载cudnn90版本,解压复制到cuda安装目录
或者官网:
https://developer.nvidia.com/cudnn
下载之后
- 解压:会生成cuda/include、cuda/lib、cuda/bin三个目录;
- 分别将cuda/include、cuda/lib、cuda/bin三个目录中的内容拷贝到C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0对应的include、lib、bin目录下即可。
复制进去即可
2、官网查看cuda9.0 支持的pytorch 版本:
官网网址:
https://pytorch.org/get-started/locally/
在pytorch官网,查看先前版本
cuda9.0 只能搭配pytorch1.1.0 torchvision0.3.0
3、安装对应版本文件
pip install torch===1.1.0 torchvision===0.3.0 -f https://download.pytorch.org/whl/torch_stable.html
或者安装pytorch1.1.0
pip3 install https://download.pytorch.org/whl/cu90/torch-1.1.0-cp37-cp37m-win_amd64.whl 成功不会失败
然后下载torchvision whl文件
可以在云里面下载,我已上传
然后pip install ..whl即可安装成功
清华源:https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud//pytorch/win-64/
whl: https://download.pytorch.org/whl/torch_stable.html