PyTorch 安装起来很简单, 它自家网页 https://pytorch.org/上就有很方便的选择方式
    image.png
    conda, CPU版

    1. $ conda create -n torch # 创建环境
    2. $ conda activate torch # 激活环境
    3. $ conda install pytorch torchvision torchaudio cpuonly -c pytorch
    4. $ python
    5. >> import torch # test

    我安装的是’1.11.0’版本的 pytorch, 你需要去他们网站上看是否有新版本的. 安装 PyTorch 会安装两个模块, 一个是 torch, 一个 torchvision, torch 是主模块, 用来搭建神经网络的, torchvision 是辅模块, 有数据库, 还有一些已经训练好的神经网络等着你直接用, 比如 (VGG, AlexNet, ResNet).

    conda, GPU版

    conda install cudatoolkit
    conda install cudnn
    conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch
    
    ## test
    python
    import torch
    print(torch.duda.is_available()) # true 查看GPU是否可用
    True