官方网址
conda install pytorch torchvision -c pytorch
缺点:经常因为网络原因安装失败。
--------------------------------------------------------------------------------------
github网址
export CMAKE_PREFIX_PATH="/home/xupp" # [anaconda root directory]
# Install basic dependencies
conda install numpy pyyaml mkl mkl-include setuptools cmake cffi typing
conda install -c mingfeima mkldnn
# Add LAPACK support for the GPU
conda install -c pytorch magma-cuda90 # or [magma-cuda80 | magma-cuda91] depending on your cuda version
备注:在安装magma时,最后报CondaError: Downloaded bytes did not match Content-Length,这个其实不是真的错误,只要在target目录下发现确实有该文件,即可。
git clone --recursive https://github.com/pytorch/pytorch
cd pytorch
python setup.py install
-----------------------------------------------------------------------------------
例如清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/ ,找到 torch 目录
参见方法一,采用该方法,终端会显示所需的 wheel 版本
pip install torch-0.3.0.post4-cp27-cp27mu-linux_x86_64.whl
pip install torch vision
终端输入:
python
import torch