pytorch环境配置
- 首先使用nvidia-smi命令查看cuda的版本,然后在这个版本之下选择想要安装的版本。之后查看pytorch与python的对应 。
- 创建环境
conda create -n torch python=xxx
conda activate torch
- 根据网址提供的对应安装版本的命令,安装torchvision, torchaudio,cudatoolkit, pytorch等。
- 判断是否配置成功的常用命令,进入python后,运行
import torch
print(torch.__version__)
print(torch.cuda.is_available()) # 如果输出True,则表示GPU版本安装成功
torch.cuda.device_count()
torch.cuda.get_device_name(0)