🎉 PyTorch 安装教程 🎉
以下为常见安装方式,根据您的环境选择合适方法:
Conda 安装
✅ 适用于 Anaconda 用户conda install pytorch torchvision torchaudio cudatoolkit=11.8 -c pytorch
*扩展阅读:[PyTorch 官方文档](https://pytorch.org/docs/stable/index.html)*Pip 安装
✅ 通用推荐方式pip3 install torch torchvision torchaudio
*扩展阅读:[PyTorch 中国社区教程](/PyTorch_使用指南)*源码编译
✅ 高度自定义需求git clone https://github.com/pytorch/pytorch.git cd pytorch python setup.py build develop
💡 安装完成后,建议通过以下命令验证:
import torch
print(torch.__version__)
点击这里了解详细验证步骤