美文网首页pytorch学习笔记pytorchPyTorch
Anaconda安装Pytorch镜像详细教程

Anaconda安装Pytorch镜像详细教程

作者: 冬风吹战鼓擂 | 来源:发表于2020-03-14 12:22 被阅读0次

    在win10基础上已经安装好了Anaconda,继续安装Pytorch。因为采用原本的下载方法实在太慢,还容易出现问题,现采取Pytorch清华镜像下载方法,亲测有效快速!!!

    1.已经安装好Anaconda

    2.搜索cmd>>>打开Anaconda Prompt

    3.添加清华镜像

    >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

    4.添加Pytorch镜像

    >conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/win-64/

    注意:这里有个坑,必须是进到win-64文件夹才可以!!!

    5.安装Pytorch(官网:https://pytorch.org/)

    >conda install pytorch torchvision cudatoolkit=10.0

    注意:博主的cuda是10.0版本,根据不同的版本搜索自己的下载语句,记住去掉-c pytorch

    -c pytorch参数指定了conda获取pytorch的channel,在此指定为conda自带的pytorch仓库。我们安装的时候去掉-c pytorch就可以使用清华镜像快速安装。

    附:cuda版本查询

    >>>打开控制面板>>>点击查看方式>>>选择小图标

    >>>点击NVIDIA控制面板

    >>>点击左下角系统信息

    >>>选择组件>>>查看cuda版本

    6.安装完成

    7.检测是否安装成功

    >>>打开cmd>>>进入python

    输入:>>>import torch 

    输入:>>>a = torch.Tensor([1.]) 

    输入:>>>a.cuda() 

    #正常则返回"tensor([ 1.], device='cuda:0')"

    输入:>>>from torch.backends import cudnn

    输入:>>>cudnn.is_acceptable(a.cuda())   

     #正常则返回 "True"

    另:查询pytorch版本

    >>>print(torch.__version__)

    相关文章

      网友评论

        本文标题:Anaconda安装Pytorch镜像详细教程

        本文链接:https://www.haomeiwen.com/subject/hjxvshtx.html