欢迎来到 PyTorch 安装指南页面!以下是如何在您的系统上安装 PyTorch 的详细步骤。
系统要求
在开始之前,请确保您的系统满足以下要求:
- 操作系统:Linux、macOS 或 Windows
- Python 版本:Python 3.6 或更高版本
安装步骤
1. 安装 Python
首先,您需要安装 Python。您可以从 Python 官网 下载并安装最新版本的 Python。
2. 安装 PyTorch
接下来,您可以使用以下命令安装 PyTorch:
pip install torch torchvision torchaudio
根据您的系统架构和 Python 版本,您可能需要使用以下命令来指定 PyTorch 的版本:
pip install torch==1.8.1 torchvision==0.9.1 torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html
3. 验证安装
安装完成后,您可以使用以下命令验证 PyTorch 是否已正确安装:
python -c "import torch; print(torch.__version__)"
如果一切正常,您将看到 PyTorch 的版本号。
扩展阅读
如果您想了解更多关于 PyTorch 的信息,请访问我们的 PyTorch 教程页面。
图片示例
下面是一张 PyTorch 的官方标志图片。