使用conda/pip安装pytorch 0.3.1教程(mac/windos/linux)

Song • 30845 次浏览 • 0 个回复 • 2018年03月28日

pytorch v0.3.1发布,添加余弦退火方案来调整学习率以及添加random_split/reduce等函数,其实更新有一段时间了,很多小伙伴安装的时候发现被墙了无法使用,所以我整理了一下方便大家使用。你可以参考自己的服务器和python版本进行选择:

一、使用conda安装pytorch 0.3.1和torchvision

包管理器 服务器 CUDA Python版本 操作方法
conda linux cuda8 python2.7 conda install pytorch torchvision -c pytorch
conda linux cuda9.0 python2.7 conda install pytorch torchvision cuda90 -c pytorch
conda linux cuda9.1 python2.7 conda install pytorch torchvision cuda91 -c pytorch
conda linux cudanone python2.7 conda install pytorch-cpu torchvision -c pytorch
conda linux cuda8 python3.5 conda install pytorch torchvision -c pytorch
conda linux cuda9.0 python3.5 conda install pytorch torchvision cuda90 -c pytorch
conda linux cuda9.1 python3.5 conda install pytorch torchvision cuda91 -c pytorch
conda linux cudanone python3.5 conda install pytorch-cpu torchvision -c pytorch
conda linux cuda8 python3.6 conda install pytorch torchvision -c pytorch
conda linux cuda9.0 python3.6 conda install pytorch torchvision cuda90 -c pytorch
conda linux cuda9.1 python3.6 conda install pytorch torchvision cuda91 -c pytorch
conda linux cudanone python3.6 conda install pytorch-cpu torchvision -c pytorch
conda osx cuda8 python2.7 conda install pytorch torchvision -c pytorch
# macOS Binaries dont support CUDA
install from source if CUDA is needed
conda osx cuda9.0 python2.7 conda install pytorch torchvision -c pytorch
# macOS Binaries dont support CUDA
install from source if CUDA is needed
conda osx cuda9.1 python2.7 conda install pytorch torchvision -c pytorch
# macOS Binaries dont support CUDA
install from source if CUDA is needed
conda osx cudanone python2.7 conda install pytorch torchvision -c pytorch
# macOS Binaries dont support CUDA
install from source if CUDA is needed
conda osx cuda8 python3.5 conda install pytorch torchvision -c pytorch
# macOS Binaries dont support CUDA
install from source if CUDA is needed
conda osx cuda9.0 python3.5 conda install pytorch torchvision -c pytorch
# macOS Binaries dont support CUDA
install from source if CUDA is needed
conda osx cuda9.1 python3.5 conda install pytorch torchvision -c pytorch
# macOS Binaries dont support CUDA
install from source if CUDA is needed
conda osx cudanone python3.5 conda install pytorch torchvision -c pytorch
# macOS Binaries dont support CUDA
install from source if CUDA is needed
conda osx cuda8 python3.6 conda install pytorch torchvision -c pytorch
# macOS Binaries dont support CUDA
install from source if CUDA is needed
conda osx cuda9.0 python3.6 conda install pytorch torchvision -c pytorch
# macOS Binaries dont support CUDA
install from source if CUDA is needed
conda osx cuda9.1 python3.6 conda install pytorch torchvision -c pytorch
# macOS Binaries dont support CUDA
install from source if CUDA is needed
conda osx cudanone python3.6 conda install pytorch torchvision -c pytorch
# macOS Binaries dont support CUDA
install from source if CUDA is needed

二、使用PIP与pip3安装pytorch 0.3.1和torchvision

除了使用conda以外,我们还可以使用pip管理工具,当我们pythonpython3.x时候,可以使用pip3安装:

包管理器 服务器 CUDA Python版本 操作方法
pip osx cuda8 python2.7 pip install http://download.pytorch.org/whl/torch-0.3.1-cp27-none-macosx_10_6_x86_64.whl
pip install torchvision
# macOS Binaries dont support CUDA
install from source if CUDA is needed
pip osx cuda9.0 python2.7 pip install http://download.pytorch.org/whl/torch-0.3.1-cp27-none-macosx_10_6_x86_64.whl
pip install torchvision
# macOS Binaries dont support CUDA
install from source if CUDA is needed
pip osx cuda9.1 python2.7 pip install http://download.pytorch.org/whl/torch-0.3.1-cp27-none-macosx_10_6_x86_64.whl
pip install torchvision
# macOS Binaries dont support CUDA
install from source if CUDA is needed
pip osx cudanone python2.7 pip install http://download.pytorch.org/whl/torch-0.3.1-cp27-none-macosx_10_6_x86_64.whl
pip install torchvision
# macOS Binaries dont support CUDA
install from source if CUDA is needed
pip osx cuda8 python3.5 pip3 install http://download.pytorch.org/whl/torch-0.3.1-cp35-cp35m-macosx_10_6_x86_64.whl
pip3 install torchvision
# macOS Binaries dont support CUDA
install from source if CUDA is needed
pip osx cuda9.0 python3.5 pip3 install http://download.pytorch.org/whl/torch-0.3.1-cp35-cp35m-macosx_10_6_x86_64.whl
pip3 install torchvision
# macOS Binaries dont support CUDA
install from source if CUDA is needed
pip osx cuda9.1 python3.5 pip3 install http://download.pytorch.org/whl/torch-0.3.1-cp35-cp35m-macosx_10_6_x86_64.whl
pip3 install torchvision
# macOS Binaries dont support CUDA
install from source if CUDA is needed
pip osx cudanone python3.5 pip3 install http://download.pytorch.org/whl/torch-0.3.1-cp35-cp35m-macosx_10_6_x86_64.whl
pip3 install torchvision
# macOS Binaries dont support CUDA
install from source if CUDA is needed
pip osx cuda8 python3.6 pip3 install http://download.pytorch.org/whl/torch-0.3.1-cp36-cp36m-macosx_10_7_x86_64.whl
pip3 install torchvision
# macOS Binaries dont support CUDA
install from source if CUDA is needed
pip osx cuda9.0 python3.6 pip3 install http://download.pytorch.org/whl/torch-0.3.1-cp36-cp36m-macosx_10_7_x86_64.whl
pip3 install torchvision
# macOS Binaries dont support CUDA
install from source if CUDA is needed
pip osx cuda9.1 python3.6 pip3 install http://download.pytorch.org/whl/torch-0.3.1-cp36-cp36m-macosx_10_7_x86_64.whl
pip3 install torchvision
# macOS Binaries dont support CUDA
install from source if CUDA is needed
pip osx cudanone python3.6 pip3 install http://download.pytorch.org/whl/torch-0.3.1-cp36-cp36m-macosx_10_7_x86_64.whl
pip3 install torchvision
# macOS Binaries dont support CUDA
install from source if CUDA is needed
pip linux cudanone python2.7 pip install http://download.pytorch.org/whl/cpu/torch-0.3.1-cp27-cp27mu-linux_x86_64.whl
pip install torchvision
# if the above command does not work
then you have python 2.7 UCS2
use this command
pip install http://download.pytorch.org/whl/cpu/torch-0.3.1-cp27-cp27m-linux_x86_64.whl
pip linux cuda8 python2.7 pip install http://download.pytorch.org/whl/cu80/torch-0.3.1-cp27-cp27mu-linux_x86_64.whl
pip install torchvision
# if the above command does not\ work
then you have python 2.7 UCS2
use this command
pip install http://download.pytorch.org/whl/cu80/torch-0.3.1-cp27-cp27m-linux_x86_64.whl
pip linux cuda9.0 python2.7 pip install http://download.pytorch.org/whl/cu90/torch-0.3.1-cp27-cp27mu-linux_x86_64.whl
pip install torchvision
# if the above command does not\ work
then you have python 2.7 UCS2
use this command
pip install http://download.pytorch.org/whl/cu90/torch-0.3.1-cp27-cp27m-linux_x86_64.whl
pip linux cuda9.1 python2.7 pip install http://download.pytorch.org/whl/cu91/torch-0.3.1-cp27-cp27mu-linux_x86_64.whl
pip install torchvision
# if the above command does not\ work
then you have python 2.7 UCS2
use this command
pip install http://download.pytorch.org/whl/cu91/torch-0.3.1-cp27-cp27m-linux_x86_64.whl
pip linux cudanone python3.5 pip3 install http://download.pytorch.org/whl/cpu/torch-0.3.1-cp35-cp35m-linux_x86_64.whl
pip3 install torchvision
pip linux cuda8 python3.5 pip3 install http://download.pytorch.org/whl/cu80/torch-0.3.1-cp35-cp35m-linux_x86_64.whl
pip3 install torchvision
pip linux cuda9.0 python3.5 pip3 install http://download.pytorch.org/whl/cu90/torch-0.3.1-cp35-cp35m-linux_x86_64.whl
pip3 install torchvision
pip linux cuda9.1 python3.5 pip3 install http://download.pytorch.org/whl/cu91/torch-0.3.1-cp35-cp35m-linux_x86_64.whl
pip3 install torchvision
pip linux cudanone python3.6 pip3 install http://download.pytorch.org/whl/cpu/torch-0.3.1-cp36-cp36m-linux_x86_64.whl
pip3 install torchvision
pip linux cuda8 python3.6 pip3 install http://download.pytorch.org/whl/cu80/torch-0.3.1-cp36-cp36m-linux_x86_64.whl
pip3 install torchvision
pip linux cuda9.0 python3.6 pip3 install http://download.pytorch.org/whl/cu90/torch-0.3.1-cp36-cp36m-linux_x86_64.whl
pip3 install torchvision
pip linux cuda9.1 python3.6 pip3 install http://download.pytorch.org/whl/cu91/torch-0.3.1-cp36-cp36m-linux_x86_64.whl
pip3 install torchvision

其实安装方法都大同小异,如果你想要查看pytorch 0.3.1的更新内容的话可以查看pytorch v0.3.1发布,添加余弦退火方案来调整学习率以及添加random_split/reduce等函数如果你已经安装了pytorch的话可以测试Pytorch如何更新版本与卸载,使用pip,conda更新卸载Pytorch


原创文章,转载请注明 :使用conda/pip安装pytorch 0.3.1教程(mac/windos/linux) - pytorch中文网
原文出处: https://ptorch.com/news/145.html
问题交流群 :168117787
提交评论
要回复文章请先登录注册
用户评论
  • 没有评论
Pytorch是什么?关于Pytorch! [100%] pytorch v0.4.0文档翻译计划召集,快来加入我们吧