Torch和torchvision的安装

要安装torch和torchvision,首先要确定你电脑安装的python的版本,
而且还要知道torch和torchvision的版本对应
 
即:torch - torchvision - python版本的对应关系
 
一. torch的安装步骤
 
1. 先查看python的版本,方法是Windows+R,输入cmd,
打开命令提示符,输入python,即可查看python的版本
 
 
 
 2. 根据python版本下载torch和torchvision,例如我电脑安装python的版本是3.9,
我下载的torch和torchvision版本如下(大家一定选取适合自己python版本的torch和torchvision进行安装)
 
(torch和torchvision下载网址:https://download.pytorch.org/whl/torch_stable.html)
 
​​​​​​​
 
 
 
 
 
 3. torch和torchvision下载好之后,就可以开始安装了cpu/torchvision-0.10.0%2Bcpu-cp39-cp39-win_amd64.whl
 
还是在命令提示符上进行安装,安装前要知道下载的torch和torchvision的位置,首先进入到该目录下,在进行命令安装,还是以我3.9的python版本为例,
 
安装torch:pip install torch-1.9.1+cpu-cp39-cp39-win_amd64.whl
 
安装torchvision:pip torchvision-0.10.0%2Bcpu-cp39-cp39-win_amd64.whl
 
 
 
 
 
 
 
 
 
 (上图红色方框内是安装命令,箭头所指是安装成功的标志)
 

您可能还会对下面的文章感兴趣:

QQ在线咨询
售前咨询
4006886185
售后服务
0731-85553175