ubuntu20编译PyTorch 源码

 

 

1. 安装anaconda

2. 安装依赖

conda install numpy ninja pyyaml mkl mkl-include setuptools cmake cffi typing_extensions future six requests dataclasses

3. 取源码

git clone --recursive https://github.com/pytorch/pytorch

4. 编译

cd pytorch
export CMAKE_PREFIX_PATH=${CONDA_PREFIX:-"$(dirname $(which conda))/../"}
python setup.py install

5. 查看版本

python3

>>> import torch
>>> torch.__version__

https://download.csdn.net/download/eidolon_foot/13820327

参考:

https://github.com/pytorch/pytorch#from-source

你可能感兴趣的:(linux,神经网络,pytorch)