登录网站:
https://pytorch.org/
https://github.com/pytorch/pytorch/tags
pytorch 没有在pypi中提供软件包.从2018年4月起,官方开始支持windows版本的,最新的版本为1.0.1版本.
找到适合自己的版本,CUDA、平台、Python等,然后会自动提示“Run this command” 命令指令进行安装。当然如果电脑没有GPU,CUDA就选none。
C:\DEV\Python36\Scripts>
pip3 install https://download.pytorch.org/whl/cpu/torch-1.0.1-cp36-cp36m-win_amd64.whl
安装好后Pytorch后,还有个torchvision安装,这个主要集成了一些数据集,深度学习模型,
一些转换等,以后需要使用还是很方便的
C:\DEV\Python36\Scripts>pip3 install torchvision
Collecting torchvision
Downloading https://files.pythonhosted.org/packages/fb/01/03fd7e503c16b3dc262483e5555ad40974ab5da8b9879e164b56c1f4ef6f/torchvision-0.2.2.post3-py2.py3-none-any.whl (64kB)
|████████████████████████████████| 71kB 328kB/s
Requirement already satisfied: numpy in c:\dev\python36\lib\site-packages (from torchvision) (1.15.4)
Requirement already satisfied: pillow>=4.1.1 in c:\dev\python36\lib\site-packages (from torchvision) (4.2.1)
Requirement already satisfied: six in c:\dev\python36\lib\site-packages (from torchvision) (1.11.0)
Requirement already satisfied: torch in c:\dev\python36\lib\site-packages (from torchvision) (1.0.1)
Requirement already satisfied: olefile in c:\dev\python36\lib\site-packages (from pillow>=4.1.1->torchvision) (0.44)
Installing collected packages: torchvision
Successfully installed torchvision-0.2.2.post3
C:\DEV\Python36\Scripts>pip list | findstr /i torch
torch 1.0.1
torchvision 0.2.2.post3
--登录python查询版本:
C:\DEV\Python36\Scripts>python
Python 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018, 00:16:47) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.__version__
'1.0.1'
>>> torch.cuda.is_available()
False