教你一分钟在win10终端成功安装Pytorch的方法步骤

时间:2022-09-11 14:28:25

小书学习的主要方向是tensorflow和pytorch,今天就来安装一下pytorch。

第一步:去官网看看

pytorch官网:(https://pytorch.org/)

点击get started

教你一分钟在win10终端成功安装Pytorch的方法步骤

第二步:选择与自己相匹配的版本,这里显示是我安装的选择。

教你一分钟在win10终端成功安装Pytorch的方法步骤

复制命令到win10终端:

第三步:成功安装:

?
1
2
3
4
5
6
c:\users\shu\desktop>pip3 install http://download.pytorch.org/whl/cpu/torch-0.4.1-cp36-cp36m-win_amd64.whl
collecting torch==0.4.1 from http://download.pytorch.org/whl/cpu/torch-0.4.1-cp36-cp36m-win_amd64.whl
 downloading http://download.pytorch.org/whl/cpu/torch-0.4.1-cp36-cp36m-win_amd64.whl (55.9mb)
  100% |████████████████████████████████| 55.9mb 2.9mb/s
installing collected packages: torch
successfully installed torch-0.4.1
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
c:\users\shu\desktop>pip3 install http://download.pytorch.org/whl/cpu/torch-0.4.1-cp36-cp36m-win_amd64.whl
collecting torch==0.4.1 from http://download.pytorch.org/whl/cpu/torch-0.4.1-cp36-cp36m-win_amd64.whl
 downloading http://download.pytorch.org/whl/cpu/torch-0.4.1-cp36-cp36m-win_amd64.whl (55.9mb)
  100% |████████████████████████████████| 55.9mb 2.9mb/s
installing collected packages: torch
successfully installed torch-0.4.1
 
c:\users\shu\desktop>pip3 install torchvision
collecting torchvision
 downloading https://files.pythonhosted.org/packages/ca/0d/f00b2885711e08bd71242ebe7b96561e6f6d01fdb4b9dcf4d37e2e13c5e1/torchvision-0.2.1-py2.py3-none-any.whl (54kb)
  100% |████████████████████████████████| 61kb 120kb/s
requirement already satisfied: numpy in c:\users\shu\appdata\local\programs\python\python36\lib\site-packages (from torchvision) (1.15.3)
requirement already satisfied: six in c:\users\shu\appdata\local\programs\python\python36\lib\site-packages (from torchvision) (1.11.0)
collecting pillow>=4.1.1 (from torchvision)
 downloading https://files.pythonhosted.org/packages/bd/39/c76eaf781343162bdb1cf4854cb3bd5947a87ee44363e5acd6c48d69c4a1/pillow-5.3.0-cp36-cp36m-win_amd64.whl (1.6mb)
  100% |████████████████████████████████| 1.6mb 81kb/s
requirement already satisfied: torch in c:\users\shu\appdata\local\programs\python\python36\lib\site-packages (from torchvision) (0.4.1)
installing collected packages: pillow, torchvision
successfully installed pillow-5.3.0 torchvision-0.2.1

谈笑间,pytorch就已经安装成功了。我这边开的热点,网速可能会快一些。
注:现在网上的教程大多是anaconda方式 安装,谁让小书是小白呢,代码编辑器是sublime text 3,所以用的都是简单粗暴的方法。

第四步:(老规矩)测试一下:

?
1
2
3
4
5
6
7
8
9
c:\users\shu\desktop>python
python 3.6.4 (v3.6.4:d48eceb, dec 19 2017, 06:54:40) [msc v.1900 64 bit (amd64)] on win32
type "help", "copyright", "credits" or "license" for more information.
>>> import pytorch
traceback (most recent call last):
 file "<stdin>", line 1, in <module>
modulenotfounderror: no module named 'pytorch'
>>> import torch
>>>

到此这篇关于教你一分钟在win10终端成功安装pytorch的方法步骤的文章就介绍到这了,更多相关win10安装pytorch内容请搜索服务器之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持服务器之家!

原文链接:https://blog.csdn.net/weixin_43012220/article/details/83786637