一、安装准备
1. 安装 VSCode
- 官网下载: Visual Studio Code - Code Editing. Redefined
- 安装时建议勾选:
- "添加到PATH" (方便终端调用)
- "注册为受支持的文件类型编辑器"
2. 安装 Python
- 官网下载: Download Python | Python.org
- 安装时勾选:
- "Add Python to PATH" (重要!)
- "Install launcher for all users"
验证安装:
python --version
pip --version
二、VSCode 基础配置
1. 安装 Python 扩展
- 打开 VSCode
- 点击左侧活动栏的扩展图标 (或 Ctrl+Shift+X)
- 搜索并安装:
- "Python" (微软官方扩展)
- "Pylance" (类型检查工具)
2. 配置 Python 解释器
- 打开命令面板 (Ctrl+Shift+P)
- 输入 "Python: Select Interpreter"
- 选择已安装的 Python 版本
3. 推荐安装的其他扩展
- "Code