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

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

一、使用conda安装pytorch 0.3.1和torchvision

包管理器服务器CUDAPython版本操作方法
condalinuxcuda8python2.7conda install pytorch torchvision -c pytorch
condalinuxcuda9.0python2.7conda install pytorch torchvision cuda90 -c pytorch
condalinuxcuda9.1python2.7conda install pytorch torchvision cuda91 -c pytorch
condalinuxcudanonepython2.7conda install pytorch-cpu torchvision -c pytorch
condalinuxcuda8python3.5conda install pytorch torchvision -c pytorch
condalinuxcuda9.0python3.5conda install pytorch torchvision cuda90 -c pytorch
condalinuxcuda9.1python3.5conda install pytorch torchvision cuda91 -c pytorch
condalinuxcudanonepython3.5conda install pytorch-cpu torchvision -c pytorch
condalinuxcuda8python3.6conda install pytorch torchvision -c pytorch
condalinuxcuda9.0python3.6conda install pytorch torchvision cuda90 -c pytorch
condalinuxcuda9.1python3.6conda install pytorch torchvision cuda91 -c pytorch
condalinuxcudanonepython3.6conda install pytorch-cpu torchvision -c pytorch
condaosxcuda8python2.7conda install pytorch torchvision -c pytorch
# macOS Binaries dont support CUDA
install from source if CUDA is needed
condaosxcuda9.0python2.7conda install pytorch torchvision -c pytorch
# macOS Binaries dont support CUDA
install from source if CUDA is needed
condaosxcuda9.1python2.7conda install pytorch torchvision -c pytorch
# macOS Binaries dont support CUDA
install from source if CUDA is needed
condaosxcudanonepython2.7conda install pytorch torchvision -c pytorch
# macOS Binaries dont support CUDA
install from source if CUDA is needed
condaosxcuda8python3.5conda install pytorch torchvision -c pytorch
# macOS Binaries dont support CUDA
install from source if CUDA is needed
condaosxcuda9.0python3.5conda install pytorch torchvision -c pytorch
# macOS Binaries dont support CUDA
install from source if CUDA is needed
condaosxcuda9.1python3.5conda install pytorch torchvision -c pytorch
# macOS Binaries dont support CUDA
install from source if CUDA is needed
condaosxcudanonepython3.5conda install pytorch torchvision -c pytorch
# macOS Binaries dont support CUDA
install from source if CUDA is needed
condaosxcuda8python3.6conda install pytorch torchvision -c pytorch
# macOS Binaries dont support CUDA
install from source if CUDA is needed
condaosxcuda9.0python3.6conda install pytorch torchvision -c pytorch
# macOS Binaries dont support CUDA
install from source if CUDA is needed
condaosxcuda9.1python3.6conda install pytorch torchvision -c pytorch
# macOS Binaries dont support CUDA
install from source if CUDA is needed
condaosxcudanonepython3.6conda 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安装:

包管理器服务器CUDAPython版本操作方法
piposxcuda8python2.7pip 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
piposxcuda9.0python2.7pip 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
piposxcuda9.1python2.7pip 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
piposxcudanonepython2.7pip 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
piposxcuda8python3.5pip3 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
piposxcuda9.0python3.5pip3 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
piposxcuda9.1python3.5pip3 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
piposxcudanonepython3.5pip3 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
piposxcuda8python3.6pip3 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
piposxcuda9.0python3.6pip3 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
piposxcuda9.1python3.6pip3 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
piposxcudanonepython3.6pip3 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
piplinuxcudanonepython2.7pip 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
piplinuxcuda8python2.7pip 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
piplinuxcuda9.0python2.7pip 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
piplinuxcuda9.1python2.7pip 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
piplinuxcudanonepython3.5pip3 install http://download.pytorch.org/whl/cpu/torch-0.3.1-cp35-cp35m-linux_x86_64.whl
pip3 install torchvision
piplinuxcuda8python3.5pip3 install http://download.pytorch.org/whl/cu80/torch-0.3.1-cp35-cp35m-linux_x86_64.whl
pip3 install torchvision
piplinuxcuda9.0python3.5pip3 install http://download.pytorch.org/whl/cu90/torch-0.3.1-cp35-cp35m-linux_x86_64.whl
pip3 install torchvision
piplinuxcuda9.1python3.5pip3 install http://download.pytorch.org/whl/cu91/torch-0.3.1-cp35-cp35m-linux_x86_64.whl
pip3 install torchvision
piplinuxcudanonepython3.6pip3 install http://download.pytorch.org/whl/cpu/torch-0.3.1-cp36-cp36m-linux_x86_64.whl
pip3 install torchvision
piplinuxcuda8python3.6pip3 install http://download.pytorch.org/whl/cu80/torch-0.3.1-cp36-cp36m-linux_x86_64.whl
pip3 install torchvision
piplinuxcuda9.0python3.6pip3 install http://download.pytorch.org/whl/cu90/torch-0.3.1-cp36-cp36m-linux_x86_64.whl
pip3 install torchvision
piplinuxcuda9.1python3.6pip3 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