各个组件的配置版本号一定要匹配,不然pytorch不能用

一、Anaconda3安装

1、清华镜像源下载:

https://link.zhihu.com/?target=https%3A//mirrors.tuna.tsinghua.edu.cn/anaconda/archive/

2、检查是否安装成功:

:::info conda —version
conda info ::: image.png

3、增加国内下载源

用户目录下没有.condarc文件,先执行conda config —set show_channel_urls yes 生成该文件之后再修改 :::info channels:

show_channel_urls: true
ssl_verify: true ::: 运行 conda clean -i 清除索引缓存,保证用的是镜像站提供的索引。

二、CUDA11.3配置与安装

CUDA11.3下载地址:https://developer.nvidia.com/cuda-11.3.0-download-archive

三、PyTorch配置与安装

1、创建Anaconda中PyTorch环境并切换

:::info conda env list
conda create -n pytorch python=3.6
conda activate pytorch
pip list :::

2、选择PyTorch11.3版本

https://pytorch.org/ :::info conda install pytorch torchvision torchaudio cudatoolkit=11.3 :::

四、测试PyTorch使用

:::info python
import torch
torch.cuda.is_available() 返回True则运行成功,False运行失败 :::