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