zoukankan      html  css  js  c++  java
  • Pytorch安装教程

    一、准备

      Window10系统+Ubuntu16.10系统、Anaconda3.5(python3.6)

    二、流程

      (1)由于墙的问题,用conda安装Pytorch过程中会连接失败,这是因为Anaconda.org的服务器在国外。在这里可以用清华TUNA镜像源,包含Anaconda仓库的镜像,将其加入conda的配置,配置如下:

    # 添加Anaconda的TUNA镜像
    $  conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
    # TUNA的help中镜像地址加有引号,需要去掉
    
    # 设置搜索时显示通道地址
    $  conda config --set show_channel_urls yes

      执行完上述命令后,会生成~/.condarc文件,记录着对conda的配置,直接手动创建、编辑该文件是相同的效果。

      (2)此时,为避免后面出现An HTTP error occurred when trying to retrieve this URL. 的错误,更改.condarc文件,操作如下:

    cd 
    sudo gedit .condarc
    
    删除 - default 所在的行
    
    .condarc的内容应该是:
    
    channels:
      - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
      - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
      - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
    show_channel_urls: true

      (3)Pytorch安装


      在这里的安装,我采用conda安装:

     

      跟据自身电脑的配置,按照 https://ptorch.com/news/30.html

      安装方法:conda,服务器:linux,Cuda版本:cudanone,Python版本:python3.6

    conda install pytorch torchvision -c soumith

      (4)测试

      进入python模式下,看能否导入torch成功:

    $  python
    >  import torch
  • 相关阅读:
    bzoj 2038 [2009国家集训队]小Z的袜子(hose)
    搭配飞行员
    codevs 1022 覆盖
    Tyvj-1338 QQ农场
    bzoj 3894 文理分科
    bzoj 1877 [SDOI2009]晨跑
    poj 3304 判断是否存在一条直线与所有线段相交
    poj 2318 向量的叉积二分查找
    poj 3608 凸包间的最小距离
    LA 4728 旋转卡壳算法求凸包的最大直径
  • 原文地址:https://www.cnblogs.com/wjunneng/p/9211897.html
Copyright © 2011-2022 走看看