在Ubuntu中更新PyTorch版本,常用方法有pip和conda两种,具体如下:
pip uninstall torch torchvision torchaudio。pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu117;CPU版本:pip install torch torchvision torchaudio。import torch,print(torch.__version__)。conda remove pytorch torchvision torchaudio。conda install pytorch torchvision torchaudio cudatoolkit=11.7 -c pytorch;CPU版本:conda install pytorch torchvision torchaudio cpuonly -c pytorch。conda list torch查看版本信息。