Windows10安装cuda、cudnn、pytorch、jupyter、fastai

版权声明:本文为博主原创文章,欢迎转载,并请注明出处。联系方式:460356155@qq.com

一直在Ubuntu中使用pytorch,现在切换到Windows系统。

一、安装cuda

1、从https://developer.nvidia.com/cuda-downloads下载相应的版本(这里选的是cuda_10.1.105_418.96_win10.exe),安装,选择自定义模式。

2、命令行运行:nvcc –V,验证安装成功。

二、安装cudnn

1、从https://developer.nvidia.com/rdp/cudnn-archive下载,但需要注册,不想注册的可直接从我的网盘下载(cudnn-10.1-windows10-x64-v7.5.0.56.zip):

  链接:https://pan.baidu.com/s/1izpA-aveYbPa-dVUxRhtFw

  提取码:pfq3

2、解压后,分别拷贝bin、lib/x64、include中的文件到cuda安装目录(如C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\)对应目录下。

三、安装pytorch

pip3 install https://download.pytorch.org/whl/cu100/torch-1.0.1-cp37-cp37m-win_amd64.whl

pip3 install torchvision

四、验证

import torch

x = torch.rand(5,3)

print(x)

print(torch.cuda.is_available())

五、安装jupyter

pip install jupyter

命令行运行:jupyter notebook --generate-config,生成配置文件:

  Writing default config to: C:\Users\Administrator\.jupyter\jupyter_notebook_config.py

修改目录:

  打开这个配置文件,找到“c.NotebookApp.notebook_dir=……”,把路径改成自己的工作目录,如:

    c.NotebookApp.notebook_dir = r\'D:\fastai\projects\'

  设置jupyter:

    pip install jupyterthemes

    jt -l # 列出背景主题列表

    jt -t grade3 -T # 设置背景主题、显示toolbar

    jt -h #帮助

    https://www.zhihu.com/question/266988943

六、安装fastai

1、安装Microsoft Visual C++ Build Tools,下载http://go.microsoft.com/fwlink/?LinkId=691126,安装。

2、pip install fastai