Pytorch学习-Pytorch各版本安装详解

﹥>﹥吖頭↗ 提交于 2019-12-12 10:14:02

1. 前言

本文主要简要介绍Pytorch命令行安装教程~

2. windows版本

conda安装

1.cuda9.0  python3.6/3.5/3.7
conda install pytorch -c pytorch
pip3 install torchvision
2.cuda8.0 python3.6/3.5/3.7
conda install pytorch cuda80 -c pytorch
pip3 install torchvision

Pip安装

1.CUDA8.0  python3.5
pip3 install http://download.pytorch.org/whl/cu80/torch-0.4.1-cp35-cp35m-win_amd64.whl
pip3 install torchvision
2.CUDA8.0  python3.6
pip3 install http://download.pytorch.org/whl/cu80/torch-0.4.1-cp36-cp36m-win_amd64.whl
pip3 install torchvision
3.CUDA8.0  python3.7
pip3 install http://download.pytorch.org/whl/cu80/torch-0.4.1-cp37-cp37m-win_amd64.whl
pip3 install torchvision

1.CUDA9.0  python3.7
pip3 install http://download.pytorch.org/whl/cu90/torch-0.4.1-cp37-cp37m-win_amd64.whl
pip3 install torchvision
2.CUDA9.0  python3.6
pip3 install http://download.pytorch.org/whl/cu90/torch-0.4.1-cp36-cp36m-win_amd64.whl
pip3 install torchvision
3.CUDA9.0  python3.5
pip3 install http://download.pytorch.org/whl/cu90/torch-0.4.1-cp35-cp35m-win_amd64.whl
pip3 install torchvision

1.CUDA9.2 python3.5
pip3 install http://download.pytorch.org/whl/cu92/torch-0.4.1-cp35-cp35m-win_amd64.whl
pip3 install torchvision
2.CUDA9.2 python3.6
pip3 install http://download.pytorch.org/whl/cu92/torch-0.4.1-cp36-cp36m-win_amd64.whl
pip3 install torchvision
3.CUDA9.2 python3.7
pip3 install http://download.pytorch.org/whl/cu92/torch-0.4.1-cp37-cp37m-win_amd64.whl
pip3 install torchvision

1.没有CUDA  python3.5
pip3 install http://download.pytorch.org/whl/cpu/torch-0.4.1-cp35-cp35m-win_amd64.whl
pip3 install torchvision
2.没有CUDA  python3.6
pip3 install http://download.pytorch.org/whl/cpu/torch-0.4.1-cp36-cp36m-win_amd64.whl
pip3 install torchvision
3.没有CUDA python3.7
pip3 install http://download.pytorch.org/whl/cpu/torch-0.4.1-cp37-cp37m-win_amd64.whl
pip3 install torchvision

3. Linux安装

conda安装

1.cuda8.0  python3.5/3.6/3.7/2.7
conda install pytorch torchvision cuda80 -c pytorch
2.cuda9.0  python3.5/3.6/3.7/2.7
conda install pytorch torchvision -c pytorch
3.cuda9.0  python3.5/3.6/3.7/2.7
conda install pytorch torchvision cuda92 -c pytorch

pip安装

1.CUDA8.0 python2.7
pip install http://download.pytorch.org/whl/cu80/torch-0.4.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.4.1-cp27-cp27m-linux_x86_64.whl
2.CUDA8.0  python3.5
pip3 install http://download.pytorch.org/whl/cu80/torch-0.4.1-cp35-cp35m-linux_x86_64.whl
pip3 install torchvision
3.CUDA8.0  python3.6
pip3 install http://download.pytorch.org/whl/cu80/torch-0.4.1-cp36-cp36m-linux_x86_64.whl
pip3 install torchvision
4.CUDA8.0  python3.7
pip3 install http://download.pytorch.org/whl/cu80/torch-0.4.1.post2-cp37-cp37m-linux_x86_64.whl
pip3 install torchvision

1.CUDA9.0  python2.7
pip install torch torchvision
2.CUDA9.0  python3.5/3.6/3.7
pip3 install torch torchvision

1.CUDA9.2  python2.7
pip install http://download.pytorch.org/whl/cu92/torch-0.4.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/cu92/torch-0.4.1-cp27-cp27m-linux_x86_64.whl
2.CUDA9.2  python3.5
pip3 install http://download.pytorch.org/whl/cu92/torch-0.4.1-cp35-cp35m-linux_x86_64.whl
pip3 install torchvision
3.CUDA9.2  python3.6
pip3 install http://download.pytorch.org/whl/cu92/torch-0.4.1-cp36-cp36m-linux_x86_64.whl
pip3 install torchvision
4.CUDA9.2  python3.7
pip3 install http://download.pytorch.org/whl/cu92/torch-0.4.1.post2-cp37-cp37m-linux_x86_64.whl
pip3 install torchvision

4. Mac安装

Conda安装

conda install pytorch torchvision -c pytorch
# MacOS Binaries dont support CUDA, install from source if CUDA is needed

Pip安装

1.python3.5/3.6/3.7
pip3 install torch torchvision
# MacOS Binaries dont support CUDA, install from source if CUDA is needed
2.python2.7
pip install torch torchvision
# MacOS Binaries dont support CUDA, install from source if CUDA is needed

cudn10版本等更多pytorch安装命令,请访问pytorch官网获得~

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!