选择适合你的操作系统 ⚙️
Windows用户
- 访问 Python官网 下载安装包
- 运行安装程序,勾选 "Add Python to PATH" 选项
- 完成安装后打开终端输入
python --version
验证
macOS用户
- 使用 Homebrew 执行
brew install python
- 或前往 Python官网 下载 dmg 文件
- 安装完成后终端输入
python3 -V
检查版本
- 使用 Homebrew 执行
Linux用户
- Ubuntu/Debian:
sudo apt update && sudo apt install python3
- Fedora:
sudo dnf install python3
- 其他发行版可访问 Python官网 获取对应包
- Ubuntu/Debian:
验证安装 🧪
打开终端输入以下命令:
python --version
或
python3 -V
成功安装会显示类似 Python 3.11.5
的版本信息
扩展学习 📚
安装完成后建议继续学习:
第一个Python程序
或查看 Python环境配置指南 了解虚拟环境使用