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


    一,pytorch的官网:

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

    说明:刘宏缔的架构森林是一个专注架构的博客,地址:https://www.cnblogs.com/architectforest

             对应的源码可以访问这里获取: 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:
  • 相关阅读:
    SpringBoot系列: Pebble模板引擎语法介绍
    SpringBoot系列: Pebble模板引擎
    SpringBoot系列: CommandLineRunner接口的用处
    SpringBoot系列: 设计Restful风格的API
    SpringBoot系列: 所有配置属性和官方文档
    Spring Security 之API 项目安全验证(基于basic-authentication)
    Spring Security 之方法级的安全管控
    SpringBoot系列: 使用 Swagger 生成 API 文档
    SpringBoot系列: Web应用鉴权思路
    SpringBoot系列: RestTemplate 快速入门
  • 原文地址:https://www.cnblogs.com/architectforest/p/16788804.html
Copyright © 2020-2023  润新知