cuda11.2安装对应版本的pytorch

配置paddle环境时用的cuda11.2,现在又要配置torch环境,查看torch官网后发现没有cuda11.2对应的torch版本。
解决办法:

pip install torch==1.11.0+cu113 -f https://download.pytorch.org/whl/torch_stable.html

测试是否可用:

import torch
print(torch.cuda.is_available()) # cuda是否可用
print(torch.cuda.device_count())  # 返回GPU的数量
print(torch.cuda.get_device_name(0))

卸载pytorch

# 使用conda卸载Pytorch
conda uninstall pytorch
conda uninstall libtorch
# 使用pip卸载Pytorch
pip uninstall torch

你可能感兴趣的:(pytorch,pytorch,深度学习,python)