安装 Miniconda + VS Code 是 Python 开发(尤其是数据科学、AI、机器学习)的黄金组合。下面为你提供一份 2026年最新、清晰、零基础友好 的详细安装指南,适用于 Windows / macOS / Linux 三大系统。
✅ 最终目标
- 安装 Miniconda(轻量版 Conda,管理 Python 环境)
- 安装 VS Code(代码编辑器)
- 在 VS Code 中正确调用 Conda 环境,实现代码高亮、调试、智能提示
第一步:安装 Miniconda
💡 为什么选 Miniconda?
相比 Anaconda(5GB+),Miniconda 只有 ~50MB,只包含 conda + Python,按需安装包,更干净高效。
🔽 下载地址
官方下载页:https://docs.conda.io/en/latest/miniconda.html
| Windows | Miniconda3 Windows 64-bit(.exe 安装包) |
| macOS (Intel) | Miniconda3 macOS Intel x86_64 |
| macOS (Apple Silicon M1/M2/M3) | Miniconda3 macOS Apple M1 64-bit |
| Linux | Miniconda3 Linux 64-bit(.sh 脚本) |
🛠️ 安装步骤
▶ Windows
⚠️ 如果没勾选 PATH,后续需在 VS Code 中手动指定 Python 解释器路径。
▶ macOS
# 下载
curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh
# 安装
bash Miniconda3-latest-MacOSX-arm64.sh
▶ Linux
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-llatest-Linux-x86_64.sh
# 同样按提示操作,最后运行 conda init
✅ 验证安装
打开 终端(Terminal)或命令提示符(CMD/PowerShell),输入:
conda –version
python –version
应显示类似:
1conda 24.5.0
2Python 3.11.9
第二步:安装 VS Code
🔽 下载地址
官方下载页:https://code.visualstudio.com/Download
- Windows:下载 .exe
- macOS:下载 .zip(拖入 Applications 文件夹)
- Linux:根据发行版选择 .deb / .rpm / tar.gz
🛠️ 安装
- Windows/macOS:双击安装,一路默认即可
- Linux:按系统习惯安装(如 Ubuntu 双击 .deb)
第三步:配置 VS Code 使用 Miniconda
1. 安装关键插件
打开 VS Code → 左侧扩展商店(Extensions)→ 搜索并安装:
| Python(by Microsoft) | 核心 Python 支持(必装!) |
| Pylance(by Microsoft) | 智能补全、类型检查(强烈推荐) |
| Jupyter(by Microsoft) | 支持 .ipynb 笔记本文件 |
✅ 安装后重启 VS Code。
2. 设置 Python 解释器(关键!)
- Windows: ~\\miniconda3\\python.exe
- macOS/Linux: /Users/xxx/miniconda3/bin/python
💡 如果没看到,点击 “Enter interpreter path…” 手动定位到 Miniconda 的 python.exe 或 bin/python。
✅ 选中后,VS Code 底部状态栏会显示当前使用的 Python 版本和环境。
3. (可选)创建独立 Conda 环境
避免包冲突,建议为每个项目创建独立环境:
# 创建名为 myproject 的环境,使用 Python 3.11
conda create -n myproject python=3.11
# 激活环境
conda activate myproject
# 安装包(例如)
pip install numpy pandas matplotlib
# 在 VS Code 中选择这个环境的解释器
# 路径通常是:
# Windows: miniconda3/envs/myproject/python.exe
# macOS: ~/miniconda3/envs/myproject/bin/python
第四步:测试是否成功
import sys
print("Python 路径:", sys.executable)
print("Conda 环境已成功集成!")
Python 路径: C:\\Users\\Alice\\miniconda3\\python.exe
Conda 环境已成功集成!
🎯 常见问题解决
| VS Code 找不到 Conda 环境 | 重启 VS Code;或手动指定解释器路径 |
| 终端中 conda 命令无效 | 重新运行 conda init,或重启终端 |
| macOS 提示“无法验证开发者” | 系统设置 → 隐私与安全性 → 允许运行 |
| 安装慢(国内用户) | 使用清华镜像: conda config –add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ |
✅ 总结:你的开发环境已就绪!
你现在拥有:
- 一个干净、可隔离的 Python 环境管理工具(Miniconda)
- 一个强大、轻量、支持 AI 开发的编辑器(VS Code)
- 可随时安装 PyTorch、TensorFlow、Hugging Face、OpenCV 等库。

