🎉 PyTorch 安装教程 🎉
以下为常见安装方式,根据您的环境选择合适方法:

  1. Conda 安装
    ✅ 适用于 Anaconda 用户

    conda install pytorch torchvision torchaudio cudatoolkit=11.8 -c pytorch
    
    conda_logo
    *扩展阅读:[PyTorch 官方文档](https://pytorch.org/docs/stable/index.html)*
  2. Pip 安装
    ✅ 通用推荐方式

    pip3 install torch torchvision torchaudio
    
    pip_logo
    *扩展阅读:[PyTorch 中国社区教程](/PyTorch_使用指南)*
  3. 源码编译
    ✅ 高度自定义需求

    git clone https://github.com/pytorch/pytorch.git  
    cd pytorch  
    python setup.py build develop
    
    github_logo

💡 安装完成后,建议通过以下命令验证:

import torch  
print(torch.__version__)

点击这里了解详细验证步骤