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

  1. Download the installer from python.org/downloads
  2. Run the installer
  3. Check “Add python.exe to PATH” at the bottom — critical
  4. Click “Install Now”
  5. 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)

  1. Download .pkg from python.org
  2. Run the installer
  3. 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 --version shows 3.10 or higher
  • pip --version works
  • Virtual environment creates and activates
  • pip install requests succeeds inside venv
  • REPL launches and runs code

What’s Next

  1. Your First Program — write and run code
  2. Python IDEs — set up VS Code or PyCharm
  3. Virtual Environments — dependency management

You’re ready to start coding.