#请先安装Anaconda和CUDA 10.0。

配置国内源

配置国内源,方便安装Numpy,Matplotlib等

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/

配置国内源,安装PyTorch用

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
也可以移除国内源,清华的源不一定更新。
conda config --remove-key channels

显示源地址

conda config --set show_channel_urls yes
安装PyTorch

安装PyTorch,要使用国内源请去掉-c pytorch这个参数!!

conda install pytorch torchvision cudatoolkit=10.0 (-c pytorch)

可以去www.pytorch.org 获取下载命令。
windows 安装pytorch
如果cuda版本不是10.1,需要查找cuda与pytorch版本的对应关系。
cuda8对应pytorch 0.4.0 对应Python 3.5 python3.6
#验证cuda是否可用
在cmd中输入python
import pytorch
torch.cuda.is_available()

返回True,则安装成功。
返回False,则要卸载pytorch
conda uninstall pytorch
在重新安装
conda install pytorch==版本号
不需要安装cudnn,在安装anaconda时就已经安装完成。
参考https://github.com/dragen1860/Deep-Learning-with-PyTorch-Tutorials

相关文章:

  • 2021-10-13
  • 2021-05-28
  • 2021-06-12
  • 2022-12-23
  • 2022-12-23
  • 2021-08-06
  • 2021-05-27
  • 2021-05-30
猜你喜欢
  • 2021-07-09
  • 2022-12-23
  • 2021-09-18
  • 2022-01-07
  • 2021-07-04
  • 2021-09-09
  • 2021-10-11
相关资源
相似解决方案