首页 > 系统相关 >rocky linux:安装pytorch(pytorch 2.0.1 / Python 3.9.16)

rocky linux:安装pytorch(pytorch 2.0.1 / Python 3.9.16)

时间:2023-08-09 10:34:29浏览次数:53  
标签:00 torch rocky MB whl 16 pytorch https

一,pytorch官网:

https://pytorch.org/

如图:

根据自己的需求选择版本、平台、语言环境等信息,

然后运行命令

二,运行pip安装命令:

[root@img bin]# pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu

Looking in indexes: https://download.pytorch.org/whl/cpu
Collecting torch
  Downloading https://download.pytorch.org/whl/cpu/torch-2.0.1%2Bcpu-cp39-cp39-linux_x86_64.whl (195.4 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 195.4/195.4 MB 2.7 MB/s eta 0:00:00
Collecting torchvision
  Downloading https://download.pytorch.org/whl/cpu/torchvision-0.15.2%2Bcpu-cp39-cp39-linux_x86_64.whl (1.5 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.5/1.5 MB 4.2 MB/s eta 0:00:00
Collecting torchaudio
  Downloading https://download.pytorch.org/whl/cpu/torchaudio-2.0.2%2Bcpu-cp39-cp39-linux_x86_64.whl (4.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.1/4.1 MB 3.3 MB/s eta 0:00:00
Collecting filelock (from torch)
  Downloading https://download.pytorch.org/whl/filelock-3.9.0-py3-none-any.whl (9.7 kB)
Collecting typing-extensions (from torch)
  Downloading https://download.pytorch.org/whl/typing_extensions-4.4.0-py3-none-any.whl (26 kB)
Collecting sympy (from torch)
  Downloading https://download.pytorch.org/whl/sympy-1.11.1-py3-none-any.whl (6.5 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.5/6.5 MB 2.7 MB/s eta 0:00:00
Collecting networkx (from torch)
  Downloading https://download.pytorch.org/whl/networkx-3.0-py3-none-any.whl (2.0 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.0/2.0 MB 1.5 MB/s eta 0:00:00
Requirement already satisfied: jinja2 in /usr/local/lib/python3.9/site-packages (from torch) (3.1.2)
Collecting numpy (from torchvision)
  Downloading https://download.pytorch.org/whl/numpy-1.24.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (17.3 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 17.3/17.3 MB 2.7 MB/s eta 0:00:00
Requirement already satisfied: requests in /usr/local/lib/python3.9/site-packages (from torchvision) (2.28.2)
Collecting pillow!=8.3.*,>=5.3.0 (from torchvision)
  Downloading https://download.pytorch.org/whl/Pillow-9.3.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.2 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.2/3.2 MB 1.9 MB/s eta 0:00:00
Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib64/python3.9/site-packages (from jinja2->torch) (2.1.2)
Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib64/python3.9/site-packages (from requests->torchvision) (3.1.0)
Requirement already satisfied: idna<4,>=2.5 in /usr/lib/python3.9/site-packages (from requests->torchvision) (2.10)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/lib/python3.9/site-packages (from requests->torchvision) (1.26.5)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.9/site-packages (from requests->torchvision) (2022.12.7)
Collecting mpmath>=0.19 (from sympy->torch)
  Downloading https://download.pytorch.org/whl/mpmath-1.2.1-py3-none-any.whl (532 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 532.6/532.6 kB 1.1 MB/s eta 0:00:00
Installing collected packages: mpmath, typing-extensions, sympy, pillow, numpy, networkx, filelock, torch, torchvision, torchaudio
  WARNING: The script isympy is installed in '/usr/local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The scripts f2py, f2py3 and f2py3.9 are installed in '/usr/local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The scripts convert-caffe2-to-onnx, convert-onnx-to-caffe2 and torchrun are installed in '/usr/local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed filelock-3.9.0 mpmath-1.2.1 networkx-3.0 numpy-1.24.1 pillow-9.3.0 sympy-1.11.1 torch-2.0.1+cpu torchaudio-2.0.2+cpu torchvision-0.15.2+cpu typing-extensions-4.4.0
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

三,安装完成后查看torch的版本:

[liuhongdi@img ~]$ python3
Python 3.9.16 (main, May 29 2023, 00:00:00)
[GCC 11.3.1 20221121 (Red Hat 11.3.1-4)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch;
>>> torch.__version__
'2.0.1+cpu’

说明:刘宏缔的架构森林—专注it技术的博客,
网站:https://blog.imgtouch.com
原文: https://blog.imgtouch.com/index.php/2023/08/03/rocky-linux-an-zhuang-pytorch-pytorch-2-1-python-3-9-16/
代码: https://github.com/liuhongdi/ 或 https://gitee.com/liuhongdi
说明:作者:刘宏缔 邮箱: [email protected]

四,查看python和pip的版本:

[liuhongdi@img ~]$ python --version
Python 3.9.16
[liuhongdi@img ~]$ pip --version
pip 23.2.1 from /usr/local/lib/python3.9/site-packages/pip (python 3.9)

标签:00,torch,rocky,MB,whl,16,pytorch,https
From: https://www.cnblogs.com/architectforest/p/17616196.html

相关文章

  • rocky linux:编译安装python3.11.4(rocky linux 9.2)
    一,查看现有的版本:1,本地版本[root@img~]#python--versionPython3.9.162,现在的最新版本:访问官网:https://www.python.org/如图:可以看到线上的最新版本是3.11.4 二,编译/安装:1,下载:先复制下载地址2,从服务器用wget命令下载:[root@imgpython]#wgethttp......
  • 利用pytorch自定义CNN网络(一):torchvision工具箱
    本文是利用pytorch自定义CNN网络系列的第一篇,主要介绍torchvision工具箱及其使用,关于本系列的全文见这里。笔者的运行设备与软件:CPU(AMDRyzen™54600U)+pytorch(1.13,CPU版)+jupyter;本文所用到的资源:链接:https://pan.baidu.com/s/1WgW3IK40Xf_Zci7D_BVLRg提取码:1212......
  • P3180 [HAOI2016] 地图
    Problem给出\(n\)个点\(m\)条边的无向连通图,且每条边最多被包含在一个环中,每个点有颜色,有\(q\)次询问,每次询问给出一个点\(x\)和参数\(y\),假如将\(1\)到\(x\)所有简单路径上的边删去后,从\(x\)出发,能到达的所有点中,颜色编号小于等于\(y\)且出现次数为奇数或偶数......
  • pytorch-两个PyTorch中的Sequential模型合并成一个
    要将两个PyTorch中的Sequential模型合并成一个,你可以使用nn.Sequential的add_module方法或者直接使用*操作符来解包Sequential模型并将它们合并。以下是两种方法的示例:方法一:使用add_module方法importtorch.nnasnn#假设你有两个Sequential模型seq1和seq2seq1=nn.Sequen......
  • LeetCode 16. 3Sum Closest 双指针+排序
    Givenanintegerarraynumsoflengthnandanintegertarget,findthreeintegersinnumssuchthatthesumisclosesttotarget.Returnthesumofthethreeintegers.Youmayassumethateachinputwouldhaveexactlyonesolution.Solution先将原数组排序,然......
  • 苹果M3 Max有两种版本:14+40?还是16+40?
    最近有关苹果M3系列处理器的消息突然多了起来,包括M3、M3Pro、M3Max,都将升级为台积电3nm工艺,但规格上比较保守,至少核心数量不会大幅增加。此前说法称,M3Max将配备14个CPU核心、40个GPU核心,相比于M2Max都增加了2个。根据最新曝料,苹果正在测试两种版本的M3Max,其一就是14+40核心......
  • 学习Java第16天
    Scanner对象之前我们学的基本语法中文名并没有实现程序和人的交互,但是Java给我们提供了这样一个工具类,我们可以获取用户的输入。Java.util.Scanner是Java5的新特征,我们可以通过Scanner类来获取用户的输入基本语法:Scanners=newScanner(System.in)通过Scanner类的ne......
  • PyTorch基础知识-新手笔记
    使用NumPy实现机器学习任务使用最原始的的NumPy实现一个有关回归的机器学习任务,不使用PyTorch中的包或类。代码可能会多一点,但每一步都是透明的,有利于理解每一步的工作原理。主要步骤如下:1)首先,给出一个数组x,然后基于表达式y=3x^2+2,加上一些噪声数据到达另一组数据。2)然后,构建......
  • PPT| APS高级计划与排产解决方案 P116
    PPT共116页,由于篇幅有限,以下为部分资料.......
  • JavaScript中16进制颜色与rgb颜色互相转换
    16进制转rgbfunctionhexToRgba(hex,opacity){if(!hex)hex='#ededed';letrgba='rgba('+parseInt('0x'+hex.slice(1,3))+','+parseInt('0x'+hex.slice(3,5))+','+......