Python 安装教程 - Windows 最佳实践
📥 方法一:官方安装器(推荐)
1. 下载 Python
访问官网下载最新版本:
- 官网地址: https://www.python.org/downloads/
- 推荐版本: Python 3.12.x 或 3.11.x(稳定版)
下载文件: python-3.12.x-amd64.exe(64 位)
2. 安装步骤
重要:安装时必须勾选以下选项!
- 双击安装程序
- ✅ 勾选 'Add Python to PATH'(最重要!)
点击 'Customize installation'(自定义安装)
可选功能(Optional Features):
- ✅ Documentation
- ✅ pip(包管理器,必选)
- ✅ tcl/tk and IDLE
- ✅ Python test suite
✅ py launcher(推荐)
高级选项(Advanced Options):
- ✅ Install for all users(为所有用户安装)
- ✅ Associate files with Python
- ✅ Create shortcuts
- ✅ Add Python to environment variables(添加到环境变量)
- ✅ Precompile standard library
- 安装路径建议:
C:\Python312(简短路径,避免空格)
- 点击 'Install' 开始安装
- 安装完成后,点击 'Disable path length limit'(禁用路径长度限制)
🔍 py vs python 的区别
1️⃣ py - Python Launcher(推荐)
特点:
- ✅ Windows 专用的 Python 启动器
- ✅ 可以管理多个 Python 版本
- ✅ 更智能,自动选择合适的版本
- ✅ 即使 PATH 没配置好也能用
用法:
py --version # 使用默认 Python 版本
py -3 --version # 使用 Python 3.x
py -3.13 --version # 使用 Python 3.13
py -2 --version # 使用 Python 2.x(如果安装了)
2️⃣ python - 直接调用 Python
特点:


