Installing Python on Windows, Mac, and Linux

Here’s a clear, step-by-step note on installing Python for Windows, Mac, and Linux:


Installing Python on Windows, Mac, and Linux


1. Installing Python on Windows

  1. Download

  2. Run Installer

    • Double-click the downloaded .exe file.
    • Important: Check the box "Add Python to PATH" before clicking Install Now.
  3. Verify Installation

    • Open Command Prompt and run:

      python --version
      
    • If installed correctly, it shows the version (e.g., Python 3.12.0).


2. Installing Python on macOS

  1. Check Existing Installation

    • macOS may come with an older Python version.

    • Open Terminal and run:

      python3 --version
      
  2. Install via Official Website

    • Download the latest .pkg file from python.org/downloads.
    • Run the installer and follow on-screen steps.
  3. Alternative: Install via Homebrew

    • Install Homebrew (if not installed):

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

      brew install python
      
  4. Verify Installation

    python3 --version
    

3. Installing Python on Linux (Ubuntu/Debian)

  1. Check Existing Python

    python3 --version
    
  2. Update Package List

    sudo apt update
    
  3. Install Python

    sudo apt install python3
    
  4. Install Pip (Package Manager)

    sudo apt install python3-pip
    
  5. Verify Installation

    python3 --version
    pip3 --version
    

4. Installing Python on Linux (Fedora/RHEL/CentOS)

sudo dnf install python3
python3 --version

5. Tips After Installation

  • Check pip:

    pip --version
    
  • Upgrade pip:

    python -m pip install --upgrade pip
    
  • Install Virtual Environment (optional but recommended):

    python -m venv myenv
    
Previous Post Next Post