linux:安装pytorch(python3.6.8 / pytorch 1.10.1+cu102)

一,pytorch的官网:

如图:
根据自己的需求选择版本、平台、语言环境等信息,
然后运行命令即可

说明:刘宏缔的架构森林是一个专注架构的博客,

网站:https://blog.imgtouch.com
本文: https://blog.imgtouch.com/index.php/2023/06/03/linux-an-zhuang-pytorch-python3-6-8-pytorch-1-10-1-cu102/

         对应的源码可以访问这里获取: https://github.com/liuhongdi/
         或: https://gitee.com/liuhongdi

说明:作者:刘宏缔 邮箱: 371125307@qq.com

二,从命令行安装:

[lhdop@blog ~]$ pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cpu
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.org/simple, https://download.pytorch.org/whl/cpu
Requirement already satisfied: torch in ./.local/lib/python3.6/site-packages (1.10.1)
Requirement already satisfied: torchvision in ./.local/lib/python3.6/site-packages (0.11.2)
Collecting torchaudio
  Downloading https://download.pytorch.org/whl/cpu/torchaudio-0.10.2%2Bcpu-cp36-cp36m-linux_x86_64.whl (2.7 MB)
     |████████████████████████████████| 2.7 MB 546 kB/s
Requirement already satisfied: typing-extensions in ./.local/lib/python3.6/site-packages (from torch) (4.1.1)
Requirement already satisfied: dataclasses in ./.local/lib/python3.6/site-packages (from torch) (0.8)
Requirement already satisfied: numpy in ./.local/lib/python3.6/site-packages (from torchvision) (1.19.5)
Requirement already satisfied: pillow!=8.3.0,>=5.3.0 in ./.local/lib/python3.6/site-packages (from torchvision) (8.1.1)
  Downloading https://download.pytorch.org/whl/cpu/torchaudio-0.10.1%2Bcpu-cp36-cp36m-linux_x86_64.whl (2.7 MB)
     |████████████████████████████████| 2.7 MB 826 kB/s
Installing collected packages: torchaudio
Successfully installed torchaudio-0.10.1+cpu

三,查看已安装的pytorch的版本:

[lhdop@blog ~]$ python3
Python 3.6.8 (default, Oct  7 2019, 17:58:22)
[GCC 8.2.1 20180905 (Red Hat 8.2.1-3)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.__version__
'1.10.1+cu102'
>>>
>>>
如图:

四,查看python和pip的版本: 

查看python的版本:
[lhdop@blog ~]$ python3 --version
Python 3.6.8

查看pip的版本:

[lhdop@blog ~]$ python3 -m pip show pip
Name: pip
Version: 21.3.1
Summary: The PyPA recommended tool for installing Python packages.
Home-page: https://pip.pypa.io/
Author: The pip developers
Author-email: distutils-sig@python.org
License: MIT
Location: /usr/local/lib/python3.6/site-packages
Requires:
Required-by:

 

posted @ 2022-10-13 17:02  刘宏缔的架构森林  阅读(1304)  评论(0编辑  收藏  举报