一、更新Pytorch和torchvision

1、使用Pip更新Pytorch和torchvision

pip list --outdated --format=legacy
pip install --upgrade pytorch torchvision

2、使用conda更新Pytorch和torchvision

conda config --add channels soumith
conda update pytorch torchvision

3、卸载Pytorch重新安装

pip uninstall torch

二、安装指定版本Pytorch

使用conda安装指定版本

# =后边是版本号
conda install pytorch=10.0 -c soumith

使用pip安装指定版本

pip3 install https://download.pytorch.org/whl/cu100/torch-1.1.0-cp37-cp37m-linux_x86_64.whl
pip3 install https://download.pytorch.org/whl/cu100/torchvision-0.3.0-cp37-cp37m-linux_x86_64.whl

三、卸载Pytorch

1、使用conda卸载Pytorch

conda uninstall pytorch
conda uninstall libtorch

2、使用pip卸载Pytorch

pip uninstall torch

四、查看当前pytorch版本

python
>>>import torch
>>>print(torch.__version__)

五、查看pytorch对应的cuda版本

python
>>>import torch
>>>torch.version.cuda
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐