Visual Studio Code (VSCode) Python 开发环境配置完整指南

一、安装准备

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 扩展

  1. 打开 VSCode
  2. 点击左侧活动栏的扩展图标 ( Ctrl+Shift+X)
  3. 搜索并安装:
    • "Python" (微软官方扩展)
    • "Pylance" (类型检查工具)

2. 配置 Python 解释器

  1. 打开命令面板 (Ctrl+Shift+P)
  2. 输入 "Python: Select Interpreter"
  3. 选择已安装的 Python 版本

3. 推荐安装的其他扩展

  • "Code

你可能感兴趣的:(Visual Studio Code (VSCode) Python 开发环境配置完整指南)