CentOS系統升級PyTorch到最新版本,可使用pip或conda包管理器,具體步驟如下:
pip install --upgrade pip。pip uninstall torch torchvision torchaudio。pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu117;若無需GPU,用pip install torch torchvision torchaudio。conda update conda。conda activate your_environment_name。conda install pytorch torchvision torchaudio cudatoolkit=11.7 -c pytorch;若無需GPU,用conda install pytorch torchvision torchaudio cpuonly -c pytorch。升級后,可通過import torch; print(torch.__version__)驗證安裝是否成功。