见链接:Anaconda3安装
在CMD或者Anaconda Prompt(Anaconda3)创建
create Create a new conda environment from a list of specified packages.
命令:conda create -n your_env_name python=x.x
创建python版本为x.x,名字为your_env_name的虚拟环境。your_env_name文件可以在Anaconda安装目录envs文件下找到。
conda create -n yolov5 python=3.9.12
有时候会出现失败的情况

找到C:\Users\用户名(比如xxx).condarc这个隐藏文件,内容改为下面
ssl_verify: true
show_channel_urls: true
channels:
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/win-64/
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/win-64/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
然后重新执行conda create -n yolov5 python=3.9.12命令,成功激活的情况如下

conda activate your_env_name

输入conda list即可查看环境配置

退出环境:deactivate
移除某个环境: conda remove --name xxx --all
在开始菜单,所有程序找到Anaconda Navigator(Anaconda3),点击Cteate创建一个环境。

找到显卡型号,到nvidia geforce驱动下载对应的驱动,安装驱动后,通过
Win11查看CUDA版本,非常简单的三步
可以查看到CUDA版本,如下图

DNN的下载链接cuDNN Download
NVIDIA cuDNN is a GPU-accelerated library of primitives for deep neural networks.


这两种方式获取CUDNN都可以,我选择第1张图这个版本
更改通道(为了下载的更快)
1.用txt形式打开C:\Users\xxx(用户名)该目录下.condarc文件
2.将如下代码全部复制进该txt
channels:
- defaults
show_channel_urls: true
default_channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud`
下载相应的pytorch,cuda与cudnn
官网链接:https://pytorch.org/get-started/locally/
根据自己的需求选择,如图所示,我们用cuda11.4为例,通过pythorch非最新版本
找到我们cuda11.4的版本,对应cudatoolkit=11.3

conda install pytorch1.12.1 torchvision0.13.1 torchaudio==0.12.1 cudatoolkit=11.3 -c pytorch

调用 conda install 安装的包将安装到此环境中
install Installs a list of packages into a specified conda environment.
