ubuntu16.04.02下简易安装pytorch

版权声明:转载请注明 谢谢 https://blog.csdn.net/bigsungod/article/details/79601522
一、Pytorch依赖库的安装
安装pytorch需要两个依赖库,pyyaml和numpy。
sudo pip install pyyaml
sudo pip install numpy

二、进行Pytorch的安装

我用的是python 2.7 系统没有安装cuda:

sudo pip install http://download.pytorch.org/whl/cu75/torch-0.2.0.post3-cp27-cp27mu-manylinux1_x86_64.whl
# if the above command does not work, then you have python 2.7 UCS2, use this command
pip install http://download.pytorch.org/whl/cu75/torch-0.2.0.post3-cp27-cp27m-manylinux1_x86_64.whl

PS:这一步要说明一下 有可能会失败 上面命令中的cp27-cp27m-manylinuxl_x86_64需要你的pip支持 查看方式如下
    方法:先输入python 然后输入import pip; print(pip.pep425tags.get_supported())可以获取到pip支持的文件名还有版本,我这里如下:>>> import pip; print(pip.pep425tags.get_supported())
[('cp27', 'cp27mu', 'manylinux1_x86_64'), ('cp27', 'cp27mu', 'linux_x86_64'), ('cp27', 'none', 'manylinux1_x86_64'), ('cp27', 'none', 'linux_x86_64'), ('py2', 'none', 'manylinux1_x86_64'), ('py2', 'none', 'linux_x86_64'), ('cp27', 'none', 'any'), ('cp2', 'none', 'any'), ('py27', 'none', 'any'), ('py2', 'none', 'any'), ('py26', 'none', 'any'), ('py25', 'none', 'any'), ('py24', 'none', 'any'), ('py23', 'none', 'any'), ('py22', 'none', 'any'), ('py21', 'none', 'any'), ('py20', 'none', 'any')]
>>>
失败的话将命令中的版本改成你支持的就好了
接下来安装torchcision:sudo pip install torchvision
我的到这里就成功安装了
验证方法在python中输入 import torch 如果没有报错就说明成功安装pytorch
小白入门 多多指教 勿喷哈






猜你喜欢

转载自blog.csdn.net/bigsungod/article/details/79601522