文章目录
一、 cpu版本
1. 安装torch
经过安装的经验,发现应该先安装torchvision。
1、下载
下载whl类型的文件:torch
cu表示的是CUDA的版本,cp表示的是python的版本。
2、安装pytorch
将下载的文件放入home下,打开终端进行安装:
pip3 install torch-0.4.0-cp35-cp35m-linux_x86_64.whl
wf@ubuntu:~/Downloads$ pip install torch-0.4.0-cp36-cp36m-linux_x86_64.whl
Processing ./torch-0.4.0-cp36-cp36m-linux_x86_64.whl
distributed 1.21.8 requires msgpack, which is not installed.
Installing collected packages: torch
Successfully installed torch-0.4.0
2. 安装torchvision
1、 使用pip命令安装
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple torchvision
wf@ubuntu:~/Downloads$ pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple torchvision
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting torchvision
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/e7/43/aaa740c406b1832adc6ff9d5e71c23fd2af2ebd436c42d76d85809ec8be9/torchvision-0.8.1-cp36-cp36m-manylinux1_x86_64.whl (12.8 MB)
|████████████████████████████████| 12.8 MB 609 kB/s
Requirement already satisfied: numpy in /home/wf/anaconda3/lib/python3.6/site-packages (from torchvision) (1.14.3)
Collecting torch==1.7.0
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/80/2a/58f8078744e0408619c63148f7a2e8e48cf007e4146b74d4bb67c56d161b/torch-1.7.0-cp36-cp36m-manylinux1_x86_64.whl (776.7 MB)
|████████████████████████████████| 776.7 MB 180 bytes/s
Requirement already satisfied: pillow>=4.1.1 in