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
-
Go to the official Python downloads page: python.org/downloads.
-
Choose the latest stable version (Python 3.x).
-
Select the appropriate installer type for your operating system (Windows, macOS, or Linux).
2. Install Python on Windows
-
Run the downloaded
.exeinstaller file. -
Important: Check the box labeled Add Python to PATH.
-
Click Install Now to start installation with default settings.
-
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
-
Download the macOS installer from the official site.
-
Open the downloaded
.pkgfile and follow the on-screen instructions. -
Alternatively, install via Homebrew:
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:
-
Red Hat/Fedora:
-
Arch Linux:
5. Verify Python Installation
After installation, confirm Python is set up correctly:
-
Open Command Prompt (Windows) or Terminal (macOS/Linux).
-
Run:
or
If the version number appears, Python is installed successfully.
6. Running Python
Once installed:
-
Interactive Mode:
Open a command line and typepython(orpython3) 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: