๐Ÿ”ง Complete Python Installation Guide

Step-by-step instructions for Windows, macOS, and Linux

๐ŸชŸ Windows Installation

Method 1: Official Python Installer (Recommended)

Step 1: Download Python

  • Visit python.org/downloads
  • Click "Download Python 3.x.x" (latest version)
  • Save the installer (e.g., python-3.11.5-amd64.exe)

Step 2: Run Installer

โš ๏ธ IMPORTANT: Check "Add Python to PATH"

  • Double-click the installer
  • โœ… Check "Add Python 3.x to PATH" (bottom of window)
  • Click "Install Now"
  • Wait for installation
  • Click "Close"

Step 3: Verify Installation

Open Command Prompt (Win + R, type cmd, press Enter):

python --version

Expected: Python 3.11.x

Method 2: Microsoft Store (Easiest)

  • Open Microsoft Store
  • Search "Python 3.11"
  • Click "Get" or "Install"
  • Wait for automatic installation

โœ… Advantages: Automatic PATH setup, automatic updates

Adding Python to PATH (If Missed)

If you forgot to check "Add to PATH":

  1. Search for "Environment Variables" in Start menu
  2. Click "Environment Variables" button
  3. Under "System variables", select "Path", click "Edit"
  4. Click "New" and add:
    • C:\Users\YourUsername\AppData\Local\Programs\Python\Python311
    • C:\Users\YourUsername\AppData\Local\Programs\Python\Python311\Scripts
  5. Click "OK" on all windows
  6. Restart Command Prompt and test

๐ŸŽ macOS Installation

Method 1: Official Python Installer (Recommended)

Step 1: Download Python

Step 2: Install

  • Double-click the .pkg file
  • Follow installation wizard
  • Enter password when prompted
  • Click "Close"

Step 3: Verify

Open Terminal (โŒ˜ + Space, type "Terminal"):

python3 --version

Expected: Python 3.11.x

Method 2: Homebrew (For Advanced Users)

If you have Homebrew installed:

# Install Homebrew if not installed
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

# Install Python
brew install python@3.11

๐Ÿง Linux Installation

Most Linux distributions come with Python pre-installed. Check first:

python3 --version

Ubuntu/Debian

sudo apt update
sudo apt install python3.11 python3-pip

Fedora/RHEL/CentOS

sudo dnf install python3.11 python3-pip

Arch Linux

sudo pacman -S python python-pip

โœ… Verify Your Installation

Check Python Version

Windows:

python --version

macOS/Linux:

python3 --version

Expected output: Python 3.11.x or higher

Check pip (Package Installer)

Windows:

pip --version

macOS/Linux:

pip3 --version

Expected output: pip 23.x.x from ...

Test Python Interactive Mode

Windows:

python

macOS/Linux:

python3

You should see:

Python 3.11.5 (main, Sep 11 2023, 13:54:46)
[GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

Type print("Hello, World!") and press Enter. You should see output.

Type exit() to leave interactive mode.

๐Ÿ”ง Troubleshooting

Problem: "python is not recognized" (Windows)

Solution 1: Use Python Launcher

py --version
py your_script.py

Solution 2: Add to PATH

See "Adding Python to PATH" section above.

Solution 3: Reinstall Python

  • Uninstall Python (Settings โ†’ Apps)
  • Reinstall, ensuring "Add to PATH" is checked

Problem: "command not found: python" (macOS/Linux)

Solution: Use python3 instead:

python3 --version
python3 your_script.py

To make python work (optional):

# Check where python3 is
which python3

# Create alias (add to ~/.bashrc or ~/.zshrc)
alias python=python3
alias pip=pip3

Problem: Multiple Python Versions Installed

Check all versions:

# Windows
py -0

# macOS/Linux
python3 --version
python3.11 --version
python3.10 --version

Use specific version:

# Windows
py -3.11 your_script.py

# macOS/Linux
python3.11 your_script.py

Problem: Permission Denied (Linux/macOS)

When running scripts:

chmod +x your_script.py
./your_script.py

Or use:

python3 your_script.py

Problem: pip Not Working

Install pip manually:

Windows:

python -m ensurepip --upgrade

macOS/Linux:

python3 -m ensurepip --upgrade

๐Ÿ’ป Setting Up Your Editor

Visual Studio Code (Recommended)

1. Download

2. Install Python Extension

  • Open VS Code
  • Click Extensions (Ctrl+Shift+X or Cmd+Shift+X)
  • Search "Python"
  • Install "Python" by Microsoft

3. Configure Python Interpreter

  • Open Command Palette (Ctrl+Shift+P or Cmd+Shift+P)
  • Type "Python: Select Interpreter"
  • Choose Python 3.11 or higher

4. Test It

  • Create new file: test.py
  • Write: print("VS Code works!")
  • Click Run button (top right) or press F5

PyCharm (Alternative)

1. Download

2. Create Project

  • Open PyCharm
  • New Project โ†’ Select Python 3.11
  • Create

3. Run Code

  • Right-click Python file โ†’ Run

Other Editors

  • Sublime Text: Lightweight, fast
  • Atom: GitHub's editor, hackable
  • Jupyter Notebook: Great for data science (install with pip install jupyter)
  • IDLE: Comes with Python, basic but functional

๐ŸŒ Virtual Environments (Optional but Recommended)

Keep project dependencies separate:

Create virtual environment:

# Windows
python -m venv myenv
myenv\Scripts\activate

# macOS/Linux
python3 -m venv myenv
source myenv/bin/activate

Deactivate:

deactivate

๐Ÿงช Testing Your Complete Setup

Create a file setup_test.py:

import sys
import platform

print("=" * 50)
print("Python Installation Test")
print("=" * 50)
print(f"Python Version: {sys.version}")
print(f"Platform: {platform.system()} {platform.release()}")
print(f"Python Executable: {sys.executable}")
print("=" * 50)
print("โœ… Everything is working correctly!")
print("=" * 50)

Run it:

python setup_test.py  # Windows
python3 setup_test.py  # macOS/Linux

Expected output:

==================================================
Python Installation Test
==================================================
Python Version: 3.11.5 (main, Sep 11 2023...)
Platform: Windows 10
Python Executable: C:\Users\...\python.exe
==================================================
โœ… Everything is working correctly!
==================================================

๐Ÿš€ Next Steps

  • โœ…Python installed and verified
  • โœ…pip working
  • โœ…Editor set up
  • โœ…Test script runs successfully

You're ready to code! ๐ŸŽ‰

๐Ÿ“š Quick Reference Commands

TaskWindowsmacOS/Linux
Run Pythonpython script.pypython3 script.py
Python versionpython --versionpython3 --version
Install packagepip install packagepip3 install package
Interactive modepythonpython3
Run with py launcherpy script.pyN/A

Installation guide last updated: December 2025