温馨提示×

Linux系统如何升级PyTorch到最新版

小樊
54
2025-08-31 19:19:13
栏目: 智能运维

Linux系统升级PyTorch到最新版主要有以下两种方法:

  • 使用pip升级
    1. 打开终端。
    2. 若需升级pip,执行pip install --upgrade pip
    3. 执行pip install --upgrade torch torchvision torchaudio,可指定CUDA版本,如pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu121(适用于CUDA 12.1)。
  • 使用conda升级
    1. 打开终端,激活conda环境(若有)。
    2. 执行conda update conda
    3. 执行conda update pytorch torchvision torchaudio cudatoolkit=X.X -c pytorch,将X.X替换为对应的CUDA版本号,不使用GPU则可省略cudatoolkit参数。

0