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

(编辑:jimmy 日期: 2024/12/26 浏览:2)

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

第一步:去官网看看

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

点击get started

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

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

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

复制命令到win10终端:

第三步:成功安装:

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 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,所以用的都是简单粗暴的方法。

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

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
>

一句话新闻

高通与谷歌联手!首款骁龙PC优化Chrome浏览器发布
高通和谷歌日前宣布,推出首次面向搭载骁龙的Windows PC的优化版Chrome浏览器。
在对骁龙X Elite参考设计的初步测试中,全新的Chrome浏览器在Speedometer 2.1基准测试中实现了显著的性能提升。
预计在2024年年中之前,搭载骁龙X Elite计算平台的PC将面世。该浏览器的提前问世,有助于骁龙PC问世就获得满血表现。
谷歌高级副总裁Hiroshi Lockheimer表示,此次与高通的合作将有助于确保Chrome用户在当前ARM兼容的PC上获得最佳的浏览体验。