在Ubuntu 20.04中安装Pytorch

Pytorch是现在一种比较流行的深度学习的框架,我们试试在Ubuntu 20.04中安装Pytorch。

安装地址

打开官网,根据自己的电脑配置选择,将会自动生成安装地址:
在这里插入图片描述

进行安装

注意:

  1. 我们使用Python3, 所使用pip3;
  2. 有时安装不成功,要多试几次
 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调试工具,
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值