安装速查表
Windows 10 / 11,VS Code,Python 3.13。
下载安装
| 软件 | 下载与安装选项 |
|---|---|
| VS Code | 官方下载页 → Windows → User Installer (x64)。安装时保留默认位置,勾选 Create a desktop icon 和 Add to PATH。 |
| 简体中文扩展 | Ctrl+Shift+X → 搜索 Chinese (Simplified) → 安装 Microsoft 发布的语言包 → 切换语言并重启。 |
| Python 3.13.17 | 官方版本页 → Files → Windows installer (64-bit)。运行 .exe,勾选 Add python.exe to PATH → Install Now → Setup was successful → Close。 |
| Python 扩展 | VS Code 中按 Ctrl+Shift+X → 搜索 @id:ms-python.python → 安装 Microsoft 发布的 Python。 |
表中的 x64 / 64-bit 适用于 Intel、AMD 的 x64 电脑。ARM 电脑下载对应的 ARM64 安装程序。
检查版本
安装完成后,新打开一个 PowerShell 窗口:
py -3.13 --version按本课版本安装,应显示 Python 3.13.17。
新建和运行文件
- 桌面新建
python-course文件夹。 - VS Code:文件 → 打开文件夹 → python-course。
- Ctrl+Shift+P → Python: Select Interpreter → Python 3.13.17。
- 新建
hello.py,写入下面一行,Ctrl+S 保存。
print("你好,我的私信助手!")点击“终端 → 新建终端”,确认当前文件夹为 python-course,再输入:
py -3.13 hello.py程序应显示:
你好,我的私信助手!
常见问题
| 情况 | 先检查 |
|---|---|
| py 不被识别 | 关掉终端,重新打开;仍失败则检查安装时的 py launcher 选项。 |
| can't open file | 文件名是否为 hello.py,终端是否位于 python-course。 |
| SyntaxError | 是否用了成对的英文括号、英文引号。 |
| 出现 >>> | 输入 exit() 并回车,返回 PS 开头的窗口后再输入运行命令。 |