Introduction

Python must be installed on your computer before you can write and run Python programs. This guide explains how to download, install, verify, and start using Python on various operating systems.

1. Download Python

  1. Go to the official Python downloads page: python.org/downloads.

  2. Choose the latest stable version (Python 3.x).

  3. Select the appropriate installer type for your operating system (Windows, macOS, or Linux).

2. Install Python on Windows

  1. Run the downloaded .exe installer file.

  2. Important: Check the box labeled Add Python to PATH.

  3. Click Install Now to start installation with default settings.

  4. Wait for the installation to complete.

Python can also be installed from the Microsoft Store, which automatically configures the PATH settings for you.

3. Install Python on macOS

  1. Download the macOS installer from the official site.

  2. Open the downloaded .pkg file and follow the on-screen instructions.

  3. Alternatively, install via Homebrew:

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" brew install python3

4. Install Python on Linux

Many Linux distributions include Python by default. If it’s not present or you want a specific version:

  • Debian/Ubuntu:

    sudo apt update sudo apt install python3
  • Red Hat/Fedora:

    sudo dnf install python3
  • Arch Linux:

    sudo pacman -S python

5. Verify Python Installation

After installation, confirm Python is set up correctly:

  • Open Command Prompt (Windows) or Terminal (macOS/Linux).

  • Run:

    python --version

    or

    python3 --version

If the version number appears, Python is installed successfully.

6. Running Python

Once installed:

  • Interactive Mode:
    Open a command line and type python (or python3) to enter the Python prompt where you can execute commands one line at a time.

  • Script Mode:
    Create a file (e.g., program.py), write Python code, and execute with:

    python program.py