Debian9.8 安装 pytorch (不安装cuda):
apt install -y git python3-dev
git clone --recursive https://github.com/pytorch/pytorch
export NO_CUDA=1
export USE_NUMPY=1
export USE_FFMPEG=1
export USE_OPENCV=1
export USE_REDIS=1
cd pytorch
pip install opencv-python numpy scipy tensorflow scikit-learn matplotlib redis ffmpeg
pip install pyyaml
pip install -r requirements.txt
python3 setup.py install
pip install torchvision
或者直接按照pytorch官网上https://pytorch.org/选择你要安装的,如:
pip install https://download.pytorch.org/whl/cpu/torch-1.0.1-cp35-cp35m-win_amd64.whl
用命令查看pytorch适合安装成功:
pip list | grep torch
简单例子:
import torch
x = torch.empty(5, 3)
print(x)
输出:
哈哈,以后就可以用pytorch开发了