macOS下Conda更新PyTorch(GPU 版本)

查看当前版本:

python -c "import torch; print(torch.__version__)"
2.3.0.dev20231221

更新命令:

conda install pytorch torchvision torchaudio -c pytorch

显示:

Retrieving notices: ...working... done
Collecting package metadata (current_repodata.json): done
Solving environment: done


==> WARNING: A newer version of conda exists. <==
  current version: 23.1.0
  latest version: 24.11.0

Please update conda by running

    $ conda update -n base -c defaults conda

Or to minimize the number of packages updated during conda update use

     conda install conda=24.11.0



## Package Plan ##

  environment location: /Users/deng/anaconda3

  added / updated specs:
    - pytorch
    - torchaudio
    - torchvision


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    pytorch-2.5.1              |          py3.9_0        56.0 MB  pytorch
    torchaudio-2.5.1           |         py39_cpu         4.8 MB  pytorch
    torchvision-0.20.1         |         py39_cpu         6.6 MB  pytorch
    ------------------------------------------------------------
                                           Total:        67.3 MB

The following packages will be UPDATED:

  pytorch            pytorch-nightly::pytorch-2.3.0.dev202~ --> pytorch::pytorch-2.5.1-py3.9_0 
  torchaudio         pytorch-nightly::torchaudio-2.2.0.dev~ --> pytorch::torchaudio-2.5.1-py39_cpu 
  torchvision        pytorch-nightly::torchvision-0.18.0.d~ --> pytorch::torchvision-0.20.1-py39_cpu 


Proceed ([y]/n)? y


Downloading and Extracting Packages
                                                                                                                          
Preparing transaction: done                                                                                               
Verifying transaction: done                                                                                               
Executing transaction: done

再次查看版本:

python -c "import torch; print(torch.__version__)"
2.5.1