Pytorch是现在一种比较流行的深度学习的框架,我们试试在Ubuntu 20.04中安装Pytorch。
安装地址
打开官网,根据自己的电脑配置选择,将会自动生成安装地址:
进行安装
注意:
- 我们使用Python3, 所使用pip3;
- 有时安装不成功,要多试几次
sudo pip3 install torch==1.6.0+cpu torchvision==0.7.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
Looking in links: https://download.pytorch.org/whl/torch_stable.html
Collecting torch==1.6.0+cpu
Using cached https://download.pytorch.org/whl/cpu/torch-1.6.0%2Bcpu-cp38-cp38-linux_x86_64.whl (154.6 MB)
Collecting torchvision==0.7.0+cpu
Downloading https://download.pytorch.org/whl/cpu/torchvision-0.7.0%2Bcpu-cp38-cp38-linux_x86_64.whl (5.1 MB)
|████████████████████████████████| 5.1 MB 8.8 kB/s
Collecting future
Downloading future-0.18.2.tar.gz (829 kB)
|████████████████████████████████| 829 kB 17 kB/s
Requirement already satisfied: numpy in /usr/lib/python3/dist-packages (from torch==1.6.0+cpu) (1.17.4)
Requirement already satisfied: pillow>=4.1.1 in /usr/lib/python3/dist-packages (from torchvision==0.7.0+cpu) (7.0.0)
Building wheels for collected packages: future
Building wheel for future (setup.py) ... done
Created wheel for future: filename=future-0.18.2-py3-none-any.whl size=491058 sha256=22d775dc1c559259ebd76c23beeace2792e4236f0c56e1d54d6e03eb890527cf
Stored in directory: /root/.cache/pip/wheels/8e/70/28/3d6ccd6e315f65f245da085482a2e1c7d14b90b30f239e2cf4
Successfully built future
Installing collected packages: future, torch, torchvision
Successfully installed future-0.18.2 torch-1.6.0+cpu torchvision-0.7.0+cpu
检测一下
打开ipython3 或其它Python调试工具,