系统要求 📱

操作系统 Python 版本 CUDA 版本
Windows 10/11 3.8 - 3.11 11.8 或更高
macOS 3.8 - 3.11 11.8 或更高
Linux 3.8 - 3.11 11.8 或更高

安装方法 🛠️

方法一:使用 pip 安装 ✅

pip install torch torchvision torchaudio

⚠️ 注意:安装前请确保已安装 Python 环境

方法二:从源码编译 🔧

git clone https://github.com/pytorch/pytorch.git
cd pytorch
python setup.py install

📌 编译需 高性能硬件支持编译工具链

验证安装 🧪

import torch
print(torch.__version__)
print(torch.cuda.is_available())

✅ 若输出版本号且显示 True,说明安装成功!

常见问题 ❓

PyTorch安装指南