ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

安装PyTorch1.6

2022-02-11 10:02:20  阅读:297  来源: 互联网

标签:1.6 torchvision PyTorch1.6 pytorch conda CUDA install 安装


安装 

  1. [Optional] Check if CUDA is installed

    It is highly recommended that you have CUDA installed. Note that PyTorch 1.6.0 does not support CUDA 11.0. If you haven't installed CUDA, please install CUDA 10.2 or install CUDA 10.1.

    Once/If you have it installed, you can check its version here.

  2. [For conda on Ubuntu/Linux and Windows 10]
    Run conda install and specify PyTorch version 1.6.0

    Starting from here, we will install PyTorch 1.6.0.

    CUDA 10.2conda install pytorch==1.6.0 torchvision==0.7.0 cudatoolkit=10.2 -c pytorch
    CUDA 10.1conda install pytorch==1.6.0 torchvision==0.7.0 cudatoolkit=10.1 -c pytorch
    CUDA 9.2conda install pytorch==1.6.0 torchvision==0.7.0 cudatoolkit=9.2 -c pytorch
    CPU Only (your PyTorch code will run slower):
    conda install pytorch==1.6.0 torchvision==0.7.0 cpuonly -c pytorch

  3. [For conda on macOS]
    Run conda install and specify PyTorch version 1.6.0

    There is only one command to install PyTorch 1.6.0 on macOS:
    conda install pytorch==1.6.0 torchvision==0.7.0 -c pytorch

  4. [For pip] Run pip3 install by specifying version with -f

    CUDA 10.2pip install torch==1.6.0 torchvision==0.7.0
    CUDA 10.1pip3 install torch==1.6.0 torchvision==0.7.0 -f https://download.pytorch.org/whl/cu101/torch_stable.html
    CUDA 10.0 is not officially supported by PyTorch 1.6.0, you have to install CUDA 10.2, CUDA 10.1, or CUDA 9.2.
    CUDA 9.2pip3 install torch==1.6.0 torchvision==0.7.0 -f https://download.pytorch.org/whl/cu92/torch_stable.html
    PyTorch 1.6.0 also doesn't support CUDA 9.1 or 9.0.
    CPU only (GPU is much better…): pip install torch==1.6.0+cpu torchvision==0.7.0+cpu -f https://download.pytorch.org/whl/torch_stable.html

  5. [For pip on macOS] Run pip3 install by specifying version with -f

    pip install torch==1.6.0 torchvision==0.7.0

下载速度慢

(点进这里,就默认了你已经安装好了anaconda,并且知道去pytorch官网找安装代码了,然后遇到了安装太慢、进度不变、多次中断的情况,这时候通常的做法,是添加清华源镜像的下载路径。但是肯定会有人和我一样,路径改了也不好使啊!!!)(补充一下镜像源方案吧!)

一、清华镜像源方案
该方案就是将官网的下载路径,改到清华镜像源的路径,先用activate激活自己之前创建的环境后,在命令行输入以下代码:

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

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

然后再去pytorch官网复制下载代码,记得删掉后面的-c pytorch,因为它表示从官网进行下载,不从清华镜像源下。
 

标签:1.6,torchvision,PyTorch1.6,pytorch,conda,CUDA,install,安装
来源: https://blog.csdn.net/qq_30460949/article/details/122874196

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有