WSL Ubuntu 环境下安装配置 Conda 指南
系统环境
- 操作系统: Windows 11
- WSL: Windows Subsystem for Linux 2
- Linux 发行版: Ubuntu 24.04.3 LTS
- 用户名: demo
- 安装工具: Miniconda3
安装过程记录
1. 检查 WSL 环境
# 检查已安装的 WSL 发行版
wsl --list --verbose
输出结果:
NAME STATE VERSION
* Ubuntu Running 2
2. 验证 Ubuntu 环境信息
wsl -e bash -c "whoami && pwd && lsb_release -a"
输出结果:
demo /mnt/e/code/workspace-temp/glm-demo1
Distributor ID: Ubuntu
Description: Ubuntu 24.04.3 LTS
Release: 24.04
Codename: noble
3. 下载 Miniconda 安装包
# 进入用户主目录并下载
wsl -e bash -c "cd ~ && wget -q https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh"
下载文件信息:
- 文件大小:156,323,998 字节
- 安装包:Miniconda3-latest-Linux-x86_64.sh
4. 静默安装 Miniconda
wsl -e bash -c "cd ~ && bash miniconda.sh -b -p ~/miniconda3"
安装输出:
PREFIX=/home/demo/miniconda3
Unpacking bootstrapper...
Unpacking payload...
Installing base environment...
Preparing transaction: ...working... done
Executing transaction: ...working... done
installation finished.
5. 配置环境变量
# 将 conda 添加到 PATH 环境变量
wsl -e bash -c "echo 'export PATH=\"$HOME/miniconda3/bin:$PATH\"' >> ~/.bashrc"
wsl -e bash -c

