On this page
article
Python Installation
Install Python 3.12 on Windows, macOS, and Linux. Set up pip, verify your installation, and troubleshoot common setup issues.
A correct installation is the foundation of everything else. This guide covers Python 3.12 on all major platforms.
Check If Python Is Already Installed
python3 --version
# Python 3.12.x
python3 -m pip --version
# pip 24.x from ...
If you see Python 3.10+, you’re likely ready. If not, install below.
Windows
- Download the installer from python.org/downloads
- Run the installer
- Check “Add python.exe to PATH” at the bottom — critical
- Click “Install Now”
- Verify in Command Prompt or PowerShell:
python --version
pip --version
Windows Troubleshooting
| Problem | Fix |
|---|---|
'python' is not recognized |
Reinstall with “Add to PATH” checked, or add manually |
| Multiple Python versions | Use py -3.12 script.py launcher |
| pip not found | python -m ensurepip --upgrade |
macOS
Option A — Official installer (recommended for beginners)
- Download
.pkgfrom python.org - Run the installer
- Verify:
python3 --version
pip3 --version
Option B — Homebrew (recommended for developers)
brew install [email protected]
python3 --version
Homebrew installs to /opt/homebrew/bin/python3 on Apple Silicon.
Linux (Ubuntu/Debian)
sudo apt update
sudo apt install python3 python3-pip python3-venv
python3 --version
python3 -m pip --version
For the latest Python on Ubuntu, use the deadsnakes PPA:
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.12 python3.12-venv python3.12-dev
Create Your First Virtual Environment
Always isolate project dependencies:
mkdir myproject && cd myproject
python3 -m venv .venv
# Activate
source .venv/bin/activate # macOS/Linux
.venv\Scripts\activate # Windows
# Confirm you're using the venv Python
which python # should point to .venv/bin/python
pip install requests
See Virtual Environments for full coverage.
Essential First Steps
# Upgrade pip
pip install --upgrade pip
# Install common tools
pip install ipython pytest black
# Verify REPL works
python3
>>> print("Hello, Python!")
>>> exit()
pyenv — Manage Multiple Python Versions
For developers who need several Python versions:
# macOS
brew install pyenv
pyenv install 3.12.0
pyenv install 3.11.0
pyenv global 3.12.0
# Linux — see https://github.com/pyenv/pyenv#installation
curl https://pyenv.run | bash
pyenv install 3.12.0
Verify Your Setup Checklist
-
python3 --versionshows 3.10 or higher -
pip --versionworks - Virtual environment creates and activates
-
pip install requestssucceeds inside venv - REPL launches and runs code
What’s Next
- Your First Program — write and run code
- Python IDEs — set up VS Code or PyCharm
- Virtual Environments — dependency management
You’re ready to start coding.