Windows环境搭建

摘要:记录在Windows搭建pytorch等的环境。

环境配置

Nvidia驱动版本:591.44

cuda版本:13.0.2

cudnn版本:9.14.0

安装miniconda

通过官网或者清华源镜像都可以下载miniconda安装包,下载好直接安装即可。

这里选择latest版本。

在系统环境变量中的PATH变量新建,分别指向miniconda3、miniconda3/Script、miniconda3/Library/bins

  • conda换源

终端输入命令

1
2
3
4
5
6
7
# 添加清华主通道(优先级最高)
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/

# 启用显示包来源,便于调试
conda config --set show_channel_urls yes
  • 使用conda init后关闭默认进入base环境:终端输入conda config --set auto_activate_base false

虚拟环境

pytorch(py3.11.8)

1
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu130

yolo(py3.11.8)

1
2
3
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu130
pip install ultralytics
pip install ipykernel