Pytorch安裝教程

1、準備html

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

2、流程linux

  (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文件,操做以下:this

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安裝url


  在這裏的安裝,我採用conda安裝:spa

 

  跟據自身電腦的配置,按照 https://ptorch.com/news/30.html.net

  安裝方法:conda,服務器:linux,Cuda版本:cudanone,Python版本:python3.6code

conda install pytorch torchvision -c soumith

  (4)測試

 

  進入python模式下,看可否導入torch成功:

$ python > import torch
相關文章
相關標籤/搜索