Installing Python
Download Python and check that it is installed from the command line.
Syntax
python --versionTo run Python on your own computer you first need to install it.
How to install
- Go to python.org and download the latest version for your operating system.
- Run the installer. On Windows, tick "Add Python to PATH" so you can run it from any terminal.
- 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
# Run this in your terminal, not in a Python file:
# python --version
#
# Output (your version may differ):
# Python 3.12.4When 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.
python --version
# Python 3.12.4
# Or on some systems:
python3 --version
# Python 3.12.4Confirm install path
Locates the Python executable to confirm the correct installation is on PATH.
# Windows (PowerShell)
where python
# C:\Users\Ada\AppData\Local\Programs\Python\Python312\python.exe
# macOS / Linux
which python3
# /usr/local/bin/python3Launch interactive REPL
Opens the Python REPL immediately after installation to run a quick sanity check.
python3
# Python 3.12.4 (main, ...)
# Type "help", "copyright" for more info.
>>> 2 + 2
4
>>> exit()
Discussion