Installing Python

Download Python and check that it is installed from the command line.

Syntaxpython --version

To run Python on your own computer you first need to install it.

How to install

  1. Go to python.org and download the latest version for your operating system.
  2. Run the installer. On Windows, tick "Add Python to PATH" so you can run it from any terminal.
  3. Open a terminal (Command Prompt, PowerShell, or Terminal) and check the version.

macOS and most Linux systems already ship with Python, but it is worth installing the latest version yourself.

Example

Example · python
# Run this in your terminal, not in a Python file:
#   python --version
#
# Output (your version may differ):
#   Python 3.12.4

When to use it

  • A developer sets up Python on a new Windows laptop before starting a Django project.
  • A student verifies their Python installation before following a data science tutorial.
  • A DevOps engineer checks the Python version on a Linux server to ensure compatibility.

More examples

Check Python version

Verifies that Python is installed and shows which version is active.

Example · bash
python --version
# Python 3.12.4

# Or on some systems:
python3 --version
# Python 3.12.4

Confirm install path

Locates the Python executable to confirm the correct installation is on PATH.

Example · bash
# Windows (PowerShell)
where python
# C:\Users\Ada\AppData\Local\Programs\Python\Python312\python.exe

# macOS / Linux
which python3
# /usr/local/bin/python3

Launch interactive REPL

Opens the Python REPL immediately after installation to run a quick sanity check.

Example · bash
python3
# Python 3.12.4 (main, ...)
# Type "help", "copyright" for more info.
>>> 2 + 2
4
>>> exit()

Discussion

  • Be the first to comment on this lesson.