Getting Started with Python: Installing Python on Windows, Linux, and macOS

Learn Python @ Freshers.in

Python is a versatile and widely-used programming language known for its simplicity and readability. Before you start your Python journey, you need to install Python on your computer. In this guide, we’ll walk you through the installation process on three major operating systems: Windows, Linux, and macOS, complete with examples and outputs.

Why Install Python?

Python comes pre-installed on some systems, but it’s essential to install it manually for several reasons:

  • Control: Installing Python gives you control over the Python version and packages.
  • Development: You can create, test, and run Python scripts and applications.
  • Customization: Install specific libraries and modules tailored to your needs.

Installing Python on Windows

Follow these steps to install Python on a Windows machine:

  1. Download Python: Visit the Python official website and download the latest Python installer for Windows (e.g., Python 3.10.1).
  2. Run the Installer: Double-click the downloaded installer file. Check the box that says “Add Python x.x to PATH” during installation.
  3. Install Python: Click the “Install Now” button to begin the installation process.
  4. Verification: Open your command prompt or PowerShell and enter python --version to verify the installation.

Example Output:

Python 3.10.1

Installing Python on Linux

Python is usually pre-installed on most Linux distributions. To check if Python is installed, open your terminal and run python --version. If Python is not installed, follow these steps:

Open Terminal: Use your package manager to install Python. For Debian/Ubuntu, run:

sudo apt-get update
sudo apt-get install python3

Verification: After installation, verify Python’s version:

python3 --version

Example Output:

Python 3.10.1

Installing Python on macOS

macOS also comes with a pre-installed Python 2.x version, but it’s recommended to install the latest Python 3 version. Follow these steps:

Install Homebrew: If you don’t have Homebrew installed, open your Terminal and run:

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

Install Python: Use Homebrew to install Python 3:

brew install python@3

Verification: Check Python’s version:

python3 --version

Example Output:

Python 3.10.1
Author: user