阅读量:2
在CentOS上更新PyTorch版本,主要有以下两种方法:
- 使用pip安装:
- 卸载旧版本:
pip uninstall torch torchvision torchaudio。 - 访问PyTorch官网,根据系统及CUDA版本选择安装命令。如使用CUDA 11.7,命令为
pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu117;若无需GPU支持,可直接用pip install torch torchvision torchaudio。 - 验证更新:
import torch,print(torch.__version__)。
- 卸载旧版本:
- 使用conda安装:
- 若用Anaconda或Miniconda,先更新conda:
conda update conda。 - 卸载旧版本:
conda remove pytorch torchvision torchaudio cudatoolkit。 - 安装新版本,如CUDA 11.7版本:
conda install pytorch torchvision torchaudio cudatoolkit=11.7 -c pytorch;不需要GPU则用conda install pytorch torchvision torchaudio cpuonly -c pytorch。 - 验证更新:
conda list torch。
- 若用Anaconda或Miniconda,先更新conda:
以上就是关于“CentOS上PyTorch的版本如何更新”的相关介绍,筋斗云是国内较早的云主机应用的服务商,拥有10余年行业经验,提供丰富的云服务器、租用服务器等相关产品服务。云服务器资源弹性伸缩,主机vCPU、内存性能强悍、超高I/O速度、故障秒级恢复;电子化备案,提交快速,专业团队7×24小时服务支持!
简单好用、高性价比云服务器租用链接:https://www.jindouyun.cn/product/cvm