Installing Python on Your Computer
Downloading Python
Head to python.org/downloads and grab the latest stable release. The site detects your operating system and offers the right installer. Always choose Python 3 — Python 2 reached end-of-life in January 2020.
Installing on Windows
Download the Windows installer (.exe) from python.org. When you run it, check the box labeled “Add python.exe to PATH” before clicking “Install Now.” This single checkbox saves you from manual PATH configuration later.
# After installation, open Command Prompt or PowerShell and verify:
python --version
You should see output like Python 3.12.2 (or whichever version you installed).
If the command is not recognized, the PATH was not set correctly. You can fix this by re-running the installer, selecting “Modify,” and ensuring the PATH option is checked.
What is PATH?
PATH is an environment variable that tells your operating system where to find executable programs. When you type python in a terminal, the system searches every directory listed in PATH for an executable with that name. Without the correct PATH entry, you would need to type the full file path to Python every time — something like C:\Users\YourName\AppData\Local\Programs\Python\Python312\python.exe.
Installing on macOS
macOS ships with an older system Python, but you should install the latest version yourself. You have two options:
Option A — Official installer: Download the .pkg file from python.org and run it. It handles PATH configuration automatically.
Option B — Homebrew:
brew install python
After either method, verify the installation:
python3 --version
On macOS, the command is typically python3 rather than python. You can create an alias in your shell configuration (~/.zshrc) if you prefer typing python:
echo 'alias python=python3' >> ~/.zshrc
source ~/.zshrc
Installing on Linux
Most Linux distributions include Python 3 out of the box. Check with:
python3 --version
If Python is missing or you need a newer version, use your distribution’s package manager:
# Debian / Ubuntu
sudo apt update
sudo apt install python3
# Fedora
sudo dnf install python3
# Arch Linux
sudo pacman -S python
Verifying Your Installation
Regardless of your operating system, a successful installation should produce clean version output:
python3 --version
# Python 3.12.2
You can also confirm that pip, the package manager bundled with Python, is available:
pip3 --version
# pip 24.0 from /usr/lib/python3.12/site-packages/pip (python 3.12)
Launching the REPL
The REPL (Read-Eval-Print Loop) is an interactive shell where you can type Python code and see results immediately. Start it by running python3 (or python on Windows) with no arguments:
python3
You will see the Python prompt:
Python 3.12.2 (main, Feb 6 2024, 20:19:44)
>>>
Try some quick expressions:
>>> 2 + 2
4
>>> "hello".upper()
'HELLO'
>>> len("Python")
6
Type exit() or press Ctrl+D (Linux/macOS) or Ctrl+Z then Enter (Windows) to leave the REPL.
The REPL is useful for testing small snippets, exploring built-in functions, and debugging. You will use it frequently as you learn Python.
Choosing a Code Editor
While not strictly part of installation, you need a place to write .py files. Popular free options include:
- VS Code — lightweight, excellent Python extension, built-in terminal
- PyCharm Community Edition — full-featured Python IDE
- Sublime Text — fast and minimal
Pick whichever feels comfortable. The important thing is that Python is now installed, on your PATH, and ready to use.
Virtual Environments
Before you start installing third-party packages, you should know about virtual environments. A virtual environment is an isolated Python installation where you can install packages without affecting your system Python or other projects.
Create one in your project directory:
python3 -m venv myproject-env
Activate it:
# macOS / Linux
source myproject-env/bin/activate
# Windows
myproject-env\Scripts\activate
When activated, your terminal prompt changes to show the environment name. Any packages you install with pip go into this environment, not your global Python installation. Deactivate it when done:
deactivate
Virtual environments are essential for keeping project dependencies separate. You will use them in every Python project.
Next Steps
With Python installed and verified, you are ready to write and run your first Python script.