Python BasicsFebruary 14, 2025

How to Install Python - Step by Step Guide

Complete guide on installing Python on Windows, macOS, and Linux. Learn how to set up your Python development environment and verify installation.

Author: Sushil Kumar

pythoninstallationsetupgetting-started

How to Install Python - Step by Step Guide

Ready to start coding in Python? Great! Let me walk you through installing Python on your computer. Don't worry - it's straightforward, and I'll guide you through every step!

Prerequisites

Before installing Python, make sure you have:

  • A computer running Windows, macOS, or Linux
  • Administrator/sudo access (for installation)
  • Internet connection (to download Python)

That's it! Python doesn't need anything else.

Method 1: Installing on Windows

Step 1: Download Python

  1. Go to python.org/downloads
  2. Click "Download Python" (latest version)
  3. The installer will download automatically

Step 2: Run the Installer

  1. Double-click the downloaded .exe file
  2. Important: Check "Add Python to PATH" at the bottom
  3. Click "Install Now"
  4. Wait for installation to complete
  5. Click "Close"

Step 3: Verify Installation

Open Command Prompt and type:

python --version

You should see something like: Python 3.11.0

Also check pip (Python package manager):

pip --version

If you see version numbers, congratulations! Python is installed!

Method 2: Installing on macOS

Step 1: Check if Python is Already Installed

macOS comes with Python 2 (old version). Check:

python3 --version

If you see Python 3.x, you might already have it!

Step 2: Download Python

  1. Go to python.org/downloads
  2. Download the macOS installer
  3. Choose the version for your Mac (Intel or Apple Silicon)

Step 3: Install Python

  1. Double-click the downloaded .pkg file
  2. Follow the installation wizard
  3. Click "Install" and enter your password
  4. Wait for installation to complete

Step 4: Verify Installation

Open Terminal and type:

python3 --version
pip3 --version

You should see version numbers!

Method 3: Installing on Linux

Ubuntu/Debian

sudo apt update
sudo apt install python3 python3-pip

CentOS/RHEL

sudo yum install python3 python3-pip

Fedora

sudo dnf install python3 python3-pip

Verify Installation

python3 --version
pip3 --version

Using Package Managers (Alternative)

macOS with Homebrew

brew install python3

Windows with Chocolatey

choco install python

Your First Python Program

Let's test that everything works! Create a file called hello.py:

print("Hello, World!")

Save it and run:

python hello.py
# or
python3 hello.py

You should see: Hello, World!

If you see this, everything is working perfectly!

Setting Up Your Editor

VS Code (Recommended)

  1. Download VS Code from code.visualstudio.com
  2. Install Python extension
  3. Open your Python file
  4. Click "Run" button or press F5

PyCharm (Popular IDE)

  1. Download PyCharm Community (free) from jetbrains.com
  2. Install and create a new project
  3. Start coding!

Understanding Python Versions

Python has two main versions:

  • Python 2 - Old version (no longer supported, don't use!)
  • Python 3 - Current version (use this!)

Always use Python 3! As of 2025, Python 3.11+ is recommended.

Virtual Environments (Important!)

Virtual environments keep your projects isolated:

# Create virtual environment
python -m venv myenv
 
# Activate (Windows)
myenv\Scripts\activate
 
# Activate (macOS/Linux)
source myenv/bin/activate
 
# Install packages
pip install package_name
 
# Deactivate
deactivate

Visual Explanation: Installation Process

Here's what happens when you install Python:

Download Python Installer


┌──────────────┐
│ Run Installer│
│              │
│ - Extract    │
│   files      │
│ - Add to PATH│
│ - Install    │
└──────┬───────┘


┌──────────────┐
│ Verify with  │
│ python       │
│ --version    │
└──────────────┘

Common Installation Issues

Issue 1: "python is not recognized"

Solution: Python is not in PATH. Reinstall and check "Add Python to PATH" option.

Issue 2: Wrong Python Version

Solution: Make sure you downloaded Python 3, not Python 2. Check python.org for latest version.

Issue 3: Permission Denied (Linux/Mac)

Solution: Use sudo for installation, or install in your home directory.

Issue 4: pip not found

Solution: Install pip separately:

python -m ensurepip --upgrade

Frequently Asked Questions (FAQ)

Q1: Which Python version should I install?

A: Always install the latest Python 3 version from python.org. As of 2025, Python 3.11 or 3.12 is recommended. Don't use Python 2!

Q2: Do I need to add Python to PATH?

A: Yes! On Windows, always check "Add Python to PATH" during installation. This lets you use python command from anywhere.

Q3: What's the difference between python and python3?

A:

  • python - Might point to Python 2 (on some systems)
  • python3 - Always Python 3

On Windows, python usually works. On Mac/Linux, use python3 to be safe.

Q4: Do I need an IDE to write Python?

A: No! You can use any text editor. But IDEs like VS Code or PyCharm make development much easier with features like autocomplete and debugging.

Q5: What is pip?

A: pip is Python's package manager. It lets you install libraries:

pip install requests
pip install numpy

Q6: Can I have multiple Python versions?

A: Yes! You can use tools like pyenv to manage multiple versions. But for beginners, one version is enough.

Q7: How do I update Python?

A: Download the new version and install it. It will usually update the existing installation. Your code will still work (Python maintains backward compatibility).

Q8: Can I install Python without admin rights?

A: Yes! Install Python to your home directory and add it to your PATH manually. No admin rights needed!

Q9: What's a virtual environment?

A: A virtual environment isolates your project's packages. It's like a separate box for each project. Always use virtual environments for projects!

Q10: How do I uninstall Python?

A:

  • Windows: Uninstall from Control Panel
  • macOS: Delete Python from Applications
  • Linux: sudo apt remove python3

Next Steps

Now that Python is installed, here's what to learn next:

Happy coding with Python! 🐍