PyTorch在Windows,Linux,Mac(conda/pip)安装方法

1、windows安装Pytorch

  • conda安装法
Python版本 CUDA版本 指令
Python3.5/3.6/3.7 CUDA8.0 1、conda install pytorch cuda80 -c pytorch 2、pip3 install torchvision
Python3.5/3.6/3.7 CUDA9.0 1、conda install pytorch -c pytorch 2、pip3 install torchvision
Python3.5/3.6/3.7 CUDA9.2 1、conda install pytorch cuda92 -c pytorch 2、pip3 install torchvision
Python3.5/3.6/3.7 None(即CPU环境) 1、conda install pytorch-cpu -c pytorch 2、pip3 install torchvision
  • pip安装法
Python版本 CUDA版本 指令
Python3.5 CUDA8.0 1、pip3 install http://download.pytorch.org/whl/cu80/torch-0.4.1-cp35-cp35m-win_amd64.whl 2、pip3 install torchvision
Python3.6 CUDA8.0 1、pip3 install http://download.pytorch.org/whl/cu80/torch-0.4.1-cp36-cp36m-win_amd64.whl 2、pip3 install torchvision
Python3.7 CUDA8.0 1、pip3 install http://download.pytorch.org/whl/cu80/torch-0.4.1-cp37-cp37m-win_amd64.whl 2、pip3 install torchvision
Python3.5 CUDA9.0 1、pip3 install http://download.pytorch.org/whl/cu90/torch-0.4.1-cp35-cp35m-win_amd64.whl 2、pip3 install torchvision
Python3.6 CUDA9.0 1、pip3 install http://download.pytorch.org/whl/cu90/torch-0.4.1-cp36-cp36m-win_amd64.whl 2、pip3 install torchvision
Python3.7 CUDA9.0 1、pip3 install http://download.pytorch.org/whl/cu90/torch-0.4.1-cp37-cp37m-win_amd64.whl 2、pip3 install torchvision
Python3.5 CUDA9.2 1、pip3 install http://download.pytorch.org/whl/cu92/torch-0.4.1-cp35-cp35m-win_amd64.whl 2、pip3 install torchvision
Python3.6 CUDA9.2 1、pip3 install http://download.pytorch.org/whl/cu92/torch-0.4.1-cp36-cp36m-win_amd64.whl 2、pip3 install torchvision
Python3.7 CUDA9.2 1、pip3 install http://download.pytorch.org/whl/cu92/torch-0.4.1-cp37-cp37m-win_amd64.whl 2、pip3 install torchvision
Python3.5 None(CPU环境) 1、pip3 install http://download.pytorch.org/whl/cpu/torch-0.4.1-cp35-cp35m-win_amd64.whl 2、pip3 install torchvision
Python3.6 None(CPU环境) 1、pip3 install http://download.pytorch.org/whl/cpu/torch-0.4.1-cp36-cp36m-win_amd64.whl 2、pip3 install torchvision
Python3.7 None(CPU环境) 1、pip3 install http://download.pytorch.org/whl/cpu/torch-0.4.1-cp37-cp37m-win_amd64.whl 2、pip3 install torchvision

2、Linux安装Pytorch

  • conda安装法
Python版本 CUDA版本 指令
Python2.7/3.5/3.6/3.7 CUDA8.0 conda install pytorch torchvision cuda80 -c pytorch
Python3.5/3.6/3.7 CUDA9.0 conda install pytorch torchvision -c pytorch
Python3.5/3.6/3.7 CUDA9.2 conda install pytorch torchvision cuda92 -c pytorch
Python3.5/3.6/3.7 None(即CPU环境) conda install pytorch-cpu torchvision-cpu -c pytorch
  • pip安装法
Python版本 CUDA版本 指令
Python3.5 CUDA8.0 1、pip3 install http://download.pytorch.org/whl/cu80/torch-0.4.1-cp35-cp35m-linux_x86_64.whl 2、pip3 install torchvision
Python3.6 CUDA8.0 1、pip3 install http://download.pytorch.org/whl/cu80/torch-0.4.1-cp36-cp36m-linux_x86_64.whl 2、pip3 install torchvision
Python3.7 CUDA8.0 1、pip3 install http://download.pytorch.org/whl/cu80/torch-0.4.1.post2-cp37-cp37m-linux_x86_64.whl 2、pip3 install torchvision
Python3.5/3.6/3.7 CUDA9.0 pip3 install torch torchvision
Python3.5 CUDA9.2 1、pip3 install http://download.pytorch.org/whl/cu92/torch-0.4.1-cp35-cp35m-linux_x86_64.whl 2、pip3 install torchvision
Python3.6 CUDA9.2 1、pip3 install http://download.pytorch.org/whl/cu92/torch-0.4.1-cp36-cp36m-linux_x86_64.whl 2、pip3 install torchvision
Python3.7 CUDA9.2 1、pip3 install http://download.pytorch.org/whl/cu92/torch-0.4.1.post2-cp37-cp37m-linux_x86_64.whl 2、pip3 install torchvision
Python3.5 None(CPU环境) 1、pip3 install http://download.pytorch.org/whl/cpu/torch-0.4.1-cp35-cp35m-linux_x86_64.whl 2、pip3 install torchvision
Python3.6 None(CPU环境) 1、pip3 install http://download.pytorch.org/whl/cpu/torch-0.4.1-cp36-cp36m-linux_x86_64.whl 2、pip3 install torchvision
Python3.7 None(CPU环境) 1、pip3 install http://download.pytorch.org/whl/cpu/torch-0.4.1.post2-cp37-cp37m-linux_x86_64.whl 2、pip3 install torchvision

3、Mac安装Pytorch

Mac OS二进制文件不支持CUDA,如果需要CUDA,则从源安装

  • conda安装法
Python版本 CUDA版本 指令
Python2.7/3.5/3.6/3.7 CUDA8.0/9.0/9.2/None conda install pytorch torchvision -c pytorch
  • pip安装法
Python版本 CUDA版本 指令
Python2.7 CUDA8.0/9.0/9.2/None pip install torch torchvision
Python3.5/3.6/3.7 CUDA8.0/9.0/9.2/None pip3 install torch torchvision

你可能感兴趣的:(PyTorch在Windows,Linux,Mac(conda/pip)安装方法)