Python · Stage 0 · Before You Code · Lesson 3 of 50

Installing Python

Install Python step by step on Windows, macOS, or Linux and confirm it works.

Windows: Open a browser and enter python.org/downloads in the address bar. Choose the large “Download Python 3” button. Open the downloaded installer. On its first screen, select Add python.exe to PATH, then choose Install Now. Accept the Windows permission question only when the publisher is the Python Software Foundation.

Close the installer, open a new PowerShell window, and type:

python --version
Line-by-line explanation
  1. python asks Windows to start Python.
  2. --version asks Python to report its version instead of opening.
  3. Output such as Python 3.14.0 means it works. Your exact number may differ.

macOS: Visit python.org/downloads/macos. Download the latest “universal2 installer”. Open the .pkg file, choose Continue through the information screens, accept the license, and choose Install. Enter your Mac password if asked. Then open Terminal and type:

python3 --version
Line-by-line explanation
  1. python3 starts the installed Python 3 program.
  2. --version asks it to show its version.
  3. Output beginning with Python 3 confirms success.

Linux: Many Linux systems already include Python. Open Terminal and check first:

python3 --version
Line-by-line explanation
  1. python3 asks Linux to find Python 3.
  2. --version asks for its version.
  3. If the answer begins with Python 3, do not install another copy.

If Ubuntu or Debian says the command is missing, use its trusted software manager:

sudo apt install python3
Line-by-line explanation
  1. sudo requests administrator permission for this command.
  2. apt is Ubuntu and Debian’s software manager.
  3. install tells it to add software.
  4. python3 is the package to add.

Fedora uses sudo dnf install python3. Do not use a Linux command meant for a different distribution.

Tiny Practice: Confirm Python

Run the correct version command for your system and find the major version.

Starter template

# Windows
python --version

# macOS or Linux
python3 --version
Line-by-line explanation
  1. Lines beginning with # are labels here; do not type those label lines.
  2. Windows normally uses python --version.
  3. macOS and Linux normally use python3 --version.
Hint
  1. Use only one command.
  2. Open a new terminal after installation.
  3. The result should begin with Python 3.
Show Solution
Python 3.14.0
Line-by-line explanation
  1. This is example output, not a command to type.
  2. 3 is the major version.
  3. Your smaller version numbers may differ.