ubuntu16.04.02下簡易安裝pytorch

一、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
小白入門 多多指教 勿噴哈






發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章