安装PyTorch框架
获取安装命令
PyTorch版本 |
Python版本 |
系统架构 |
CANN版本 |
安装方式 |
安装命令 |
---|---|---|---|---|---|
1.11.0 |
Python 3.7和Python 3.7m |
AArch64 |
8.0.RC2 |
Pip |
# 下载软件包 wget https://download.pytorch.org/whl/torch-1.11.0-cp37-cp37m-manylinux2014_aarch64.whl # 安装命令 pip3 install torch-1.11.0-cp37-cp37m-manylinux2014_aarch64.whl # 根据“安装前必读”完成环境变量配置 |
Source |
# 具体步骤请参考PyTorch官网:https://github.com/pytorch/pytorch?tab=readme-ov-file#from-source。 |
||||
Python 3.7和Python 3.7m |
X86_64 |
8.0.RC2 |
Pip |
# 下载软件包 wget https://download.pytorch.org/whl/cpu/torch-1.11.0%2Bcpu-cp37-cp37m-linux_x86_64.whl # 安装命令 pip3 install torch-1.11.0+cpu-cp37-cp37m-linux_x86_64.whl # 根据“安装前必读”完成环境变量配置 |
|
Source |
# 具体步骤请参考PyTorch官网:https://github.com/pytorch/pytorch?tab=readme-ov-file#from-source。 |
||||
Python 3.8 |
AArch64 |
8.0.RC2 |
Pip |
# 下载软件包 wget https://download.pytorch.org/whl/torch-1.11.0-cp38-cp38-manylinux2014_aarch64.whl # 安装命令 pip3 install torch-1.11.0-cp38-cp38-manylinux2014_aarch64.whl # 根据“安装前必读”完成环境变量配置 |
|
Source |
# 具体步骤请参考PyTorch官网:https://github.com/pytorch/pytorch?tab=readme-ov-file#from-source。 |
||||
Python 3.8 |
X86_64 |
8.0.RC2 |
Pip |
# 下载软件包 wget https://download.pytorch.org/whl/cpu/torch-1.11.0%2Bcpu-cp38-cp38-linux_x86_64.whl # 安装命令 pip3 install torch-1.11.0+cpu-cp38-cp38-linux_x86_64.whl # 根据“安装前必读”完成环境变量配置 |
|
Source |
# 具体步骤请参考PyTorch官网:https://github.com/pytorch/pytorch?tab=readme-ov-file#from-source。 |
||||
Python 3.9 |
AArch64 |
8.0.RC2 |
Pip |
# 下载软件包 wget https://download.pytorch.org/whl/torch-1.11.0-cp39-cp39-manylinux2014_aarch64.whl # 安装命令 pip3 install torch-1.11.0-cp39-cp39-manylinux2014_aarch64.whl # 根据“安装前必读”完成环境变量配置 |
|
Source |
# 具体步骤请参考PyTorch官网:https://github.com/pytorch/pytorch?tab=readme-ov-file#from-source。 |
||||
Python 3.9 |
X86_64 |
8.0.RC2 |
Pip |
# 下载软件包 wget https://download.pytorch.org/whl/cpu/torch-1.11.0%2Bcpu-cp39-cp39-linux_x86_64.whl # 安装命令 pip3 install torch-1.11.0+cpu-cp39-cp39-linux_x86_64.whl # 根据“安装前必读”完成环境变量配置 |
|
Source |
# 具体步骤请参考PyTorch官网:https://github.com/pytorch/pytorch?tab=readme-ov-file#from-source。 |
||||
Python 3.10 |
AArch64 |
8.0.RC2 |
Pip |
# 下载软件包 wget https://download.pytorch.org/whl/torch-1.11.0-cp310-cp310-manylinux2014_aarch64.whl # 安装命令 pip3 install torch-1.11.0-cp310-cp310-manylinux2014_aarch64.whl # 根据“安装前必读”完成环境变量配置 |
|
Source |
# 具体步骤请参考PyTorch官网:https://github.com/pytorch/pytorch?tab=readme-ov-file#from-source。 |
||||
Python 3.10 |
X86_64 |
8.0.RC2 |
Pip |
# 下载软件包 wget https://download.pytorch.org/whl/cpu/torch-1.11.0%2Bcpu-cp310-cp310-linux_x86_64.whl # 安装命令 pip3 install torch-1.11.0+cpu-cp310-cp310-linux_x86_64.whl # 根据“安装前必读”完成环境变量配置 |
|
Source |
# 具体步骤请参考PyTorch官网:https://github.com/pytorch/pytorch?tab=readme-ov-file#from-source。 |
||||
2.1.0 |
Python 3.8 |
AArch64 |
8.0.RC2 |
Pip |
# 下载软件包 wget https://download.pytorch.org/whl/cpu/torch-2.1.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl # 安装命令 pip3 install torch-2.1.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl # 根据“安装前必读”完成环境变量配置 |
Source |
# 具体步骤请参考PyTorch官网:https://github.com/pytorch/pytorch?tab=readme-ov-file#from-source。 |
||||
Python 3.8 |
X86_64 |
8.0.RC2 |
Pip |
# 下载软件包 wget https://download.pytorch.org/whl/cpu/torch-2.1.0%2Bcpu-cp38-cp38-linux_x86_64.whl # 安装命令 pip3 install torch-2.1.0+cpu-cp38-cp38-linux_x86_64.whl # 根据“安装前必读”完成环境变量配置 |
|
Source |
# 具体步骤请参考PyTorch官网:https://github.com/pytorch/pytorch?tab=readme-ov-file#from-source。 |
||||
Python 3.9 |
AArch64 |
8.0.RC2 |
Pip |
# 下载软件包 wget https://download.pytorch.org/whl/cpu/torch-2.1.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl # 安装命令 pip3 install torch-2.1.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl # 根据“安装前必读”完成环境变量配置 |
|
Source |
# 具体步骤请参考PyTorch官网:https://github.com/pytorch/pytorch?tab=readme-ov-file#from-source。 |
||||
Python 3.9 |
X86_64 |
8.0.RC2 |
Pip |
# 下载软件包 wget https://download.pytorch.org/whl/cpu/torch-2.1.0%2Bcpu-cp39-cp39-linux_x86_64.whl # 安装命令 pip3 install torch-2.1.0+cpu-cp39-cp39-linux_x86_64.whl # 根据“安装前必读”完成环境变量配置 |
|
Source |
# 具体步骤请参考PyTorch官网:https://github.com/pytorch/pytorch?tab=readme-ov-file#from-source。 |
||||
Python 3.10 |
AArch64 |
8.0.RC2 |
Pip |
# 下载软件包 wget https://download.pytorch.org/whl/cpu/torch-2.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl # 安装命令 pip3 install torch-2.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl # 根据“安装前必读”完成环境变量配置 |
|
Source |
# 具体步骤请参考PyTorch官网:https://github.com/pytorch/pytorch?tab=readme-ov-file#from-source。 |
||||
Python 3.10 |
X86_64 |
8.0.RC2 |
Pip |
# 下载软件包 wget https://download.pytorch.org/whl/cpu/torch-2.1.0%2Bcpu-cp310-cp310-linux_x86_64.whl # 安装命令 pip3 install torch-2.1.0+cpu-cp310-cp310-linux_x86_64.whl # 根据“安装前必读”完成环境变量配置 |
|
Source |
# 具体步骤请参考PyTorch官网:https://github.com/pytorch/pytorch?tab=readme-ov-file#from-source。 |
||||
2.2.0 |
Python 3.8 |
AArch64 |
8.0.RC2 |
Pip |
# 下载软件包 wget https://download.pytorch.org/whl/cpu/torch-2.2.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl # 安装命令 pip3 install torch-2.2.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl # 根据“安装前必读”完成环境变量配置 |
Source |
# 具体步骤请参考PyTorch官网:https://github.com/pytorch/pytorch?tab=readme-ov-file#from-source。 |
||||
Python 3.8 |
X86_64 |
8.0.RC2 |
Pip |
# 下载软件包 wget https://download.pytorch.org/whl/cpu/torch-2.2.0%2Bcpu-cp38-cp38-linux_x86_64.whl # 安装命令 pip3 install torch-2.2.0+cpu-cp38-cp38-linux_x86_64.whl # 根据“安装前必读”完成环境变量配置 |
|
Source |
# 具体步骤请参考PyTorch官网:https://github.com/pytorch/pytorch?tab=readme-ov-file#from-source。 |
||||
Python 3.9 |
AArch64 |
8.0.RC2 |
Pip |
# 下载软件包 wget https://download.pytorch.org/whl/cpu/torch-2.2.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl # 安装命令 pip3 install torch-2.2.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl # 根据“安装前必读”完成环境变量配置 |
|
Source |
# 具体步骤请参考PyTorch官网:https://github.com/pytorch/pytorch?tab=readme-ov-file#from-source。 |
||||
Python 3.9 |
X86_64 |
8.0.RC2 |
Pip |
# 下载软件包 wget https://download.pytorch.org/whl/cpu/torch-2.2.0%2Bcpu-cp39-cp39-linux_x86_64.whl # 安装命令 pip3 install torch-2.2.0+cpu-cp39-cp39-linux_x86_64.whl # 根据“安装前必读”完成环境变量配置 |
|
Source |
# 具体步骤请参考PyTorch官网:https://github.com/pytorch/pytorch?tab=readme-ov-file#from-source。 |
||||
Python 3.10 |
AArch64 |
8.0.RC2 |
Pip |
# 下载软件包 wget https://download.pytorch.org/whl/cpu/torch-2.2.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl # 安装命令 pip3 install torch-2.2.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl # 根据“安装前必读”完成环境变量配置 |
|
Source |
# 具体步骤请参考PyTorch官网:https://github.com/pytorch/pytorch?tab=readme-ov-file#from-source。 |
||||
Python 3.10 |
X86_64 |
8.0.RC2 |
Pip |
# 下载软件包 wget https://download.pytorch.org/whl/cpu/torch-2.2.0%2Bcpu-cp310-cp310-linux_x86_64.whl # 安装命令 pip3 install torch-2.2.0+cpu-cp310-cp310-linux_x86_64.whl # 根据“安装前必读”完成环境变量配置 |
|
Source |
# 具体步骤请参考PyTorch官网:https://github.com/pytorch/pytorch?tab=readme-ov-file#from-source。 |
||||
2.3.1 |
Python 3.8 |
AArch64 |
8.0.RC2 |
Pip |
# 下载软件包 wget https://download.pytorch.org/whl/cpu/torch-2.3.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl # 安装命令 pip3 install torch-2.3.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl # 根据“安装前必读”完成环境变量配置 |
Source |
# 具体步骤请参考PyTorch官网:https://github.com/pytorch/pytorch?tab=readme-ov-file#from-source。 |
||||
Python 3.8 |
X86_64 |
8.0.RC2 |
Pip |
# 下载软件包 wget https://download.pytorch.org/whl/cpu/torch-2.3.1%2Bcpu-cp38-cp38-linux_x86_64.whl # 安装命令 pip3 installtorch-2.3.1+cpu-cp38-cp38-linux_x86_64.whl # 根据“安装前必读”完成环境变量配置 |
|
Source |
# 具体步骤请参考PyTorch官网:https://github.com/pytorch/pytorch?tab=readme-ov-file#from-source。 |
||||
Python 3.9 |
AArch64 |
8.0.RC2 |
Pip |
# 下载软件包 wget https://download.pytorch.org/whl/cpu/torch-2.3.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl # 安装命令 pip3 install torch-2.3.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl # 根据“安装前必读”完成环境变量配置 |
|
Source |
# 具体步骤请参考PyTorch官网:https://github.com/pytorch/pytorch?tab=readme-ov-file#from-source。 |
||||
Python 3.9 |
X86_64 |
8.0.RC2 |
Pip |
# 下载软件包 wget https://download.pytorch.org/whl/cpu/torch-2.3.1%2Bcpu-cp39-cp39-linux_x86_64.whl # 安装命令 pip3 install torch-2.3.1+cpu-cp39-cp39-linux_x86_64.whl # 根据“安装前必读”完成环境变量配置 |
|
Source |
# 具体步骤请参考PyTorch官网:https://github.com/pytorch/pytorch?tab=readme-ov-file#from-source。 |
||||
Python 3.10 |
AArch64 |
8.0.RC2 |
Pip |
# 下载软件包 wget https://download.pytorch.org/whl/cpu/torch-2.3.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl # 安装命令 pip3 install torch-2.3.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl # 根据“安装前必读”完成环境变量配置 |
|
Source |
# 具体步骤请参考PyTorch官网:https://github.com/pytorch/pytorch?tab=readme-ov-file#from-source。 |
||||
Python 3.10 |
X86_64 |
8.0.RC2 |
Pip |
# 下载软件包 wget https://download.pytorch.org/whl/cpu/torch-2.3.1%2Bcpu-cp310-cp310-linux_x86_64.whl # 安装命令 pip3 install torch-2.3.1+cpu-cp310-cp310-linux_x86_64.whl # 根据“安装前必读”完成环境变量配置 |
|
Source |
# 具体步骤请参考PyTorch官网:https://github.com/pytorch/pytorch?tab=readme-ov-file#from-source。 |
其他参考
使用以下命令可以直接从PyTorch官方预编译包的下载页面中,选择与本地环境匹配的版本包来安装PyTorch,包括匹配操作系统平台(例如Linux)和匹配系统的Python版本号(例如cp37)。例如torch==1.11.0+cpu:指定安装torch版本为1.11.0,并且是CPU版本。
- 安装1.11.0版本
pip3 install torch==1.11.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
- 安装2.1.0版本
pip3 install torch==2.1.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
- 安装2.2.0版本
pip3 install torch==2.2.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
- 安装2.3.1版本
pip3 install torch==2.3.1+cpu -f https://download.pytorch.org/whl/torch_stable.html
- 安装1.11.0版本
pip3 install torch==1.11.0 -f https://download.pytorch.org/whl/torch_stable.html
- 安装2.1.0版本
pip3 install torch==2.1.0 -f https://download.pytorch.org/whl/torch_stable.html
- 安装2.2.0版本
pip3 install torch==2.2.0 -f https://download.pytorch.org/whl/torch_stable.html
- 安装2.3.1版本
pip3 install torch==2.3.1 -f https://download.pytorch.org/whl/torch_stable.html