Python Learning Guide: Installing Python

Who this guide is for

  • Beginners who want a clean Python setup on Windows, Linux, or macOS
  • Learners who installed Python before but are unsure whether it is configured correctly
  • Developers who need a reliable base before creating virtual environments and projects

What you’ll learn

  • How to install Python using the most common methods on each operating system
  • How to verify your installation from the terminal using version checks
  • How to decide between multiple installation paths on Windows (official installer, Microsoft Store, Chocolatey, Laragon)
  • The most common setup mistakes and how to fix them quickly
  • How to confirm your machine is ready for the next guide (virtual environments)

Why this topic matters

Many Python learning problems are not caused by code. They are caused by setup issues: wrong PATH, outdated Python, conflicting installs, or unclear terminal behavior. A correct installation saves hours of confusion later.

This guide helps you install Python in a practical, repeatable way. You will learn what “correct” looks like, how to verify it, and how to troubleshoot common issues before moving to project-based workflows.

Core concepts

Installation source matters

Where you install Python from affects updates, terminal behavior, and package management experience.

Typical options:

  • Official installer from python.org: most direct and predictable for most learners
  • OS package managers (apt, dnf, Homebrew): convenient if you already use terminal-first workflows
  • Tooling ecosystems (Chocolatey, Laragon): useful when integrating with existing dev stacks

General recommendation for beginners:

  • Use the official Python installer unless you have a strong reason not to

Verifying installation is mandatory

Do not assume installation succeeded just because a wizard finished. Always verify in terminal.

Run one of these:

python --version

or:

python3 --version

Expected result (example):

Python 3.12.2

If the command fails, your install is incomplete or terminal PATH is not configured correctly.

Version strategy for this learning series

This series targets modern Python. You should use Python 3.11+ or 3.12+ whenever possible.

Practical guidance:

  • Prefer Python 3.12 for new learning projects
  • Use Python 3.11 if a dependency is not yet stable on 3.12
  • Avoid mixing multiple Python versions in one beginner project

You can list Python launchers on Windows with:

py -0p

This helps you see installed versions and their locations.

Understand command differences: python, python3, and py

Different systems expose Python commands differently:

  • Windows often supports py (Python Launcher) and sometimes python
  • Linux/macOS commonly use python3
  • Some machines map python to Python 3, others do not

Useful check commands:

py --version
python --version
python3 --version

You only need one reliable command path, but you must know which one works on your system.

Step-by-step walkthrough

Step 1 — Install Python on your operating system

Choose one method and complete it fully.

Windows options:

  • Official installer (recommended): download from python.org and enable “Add Python to PATH”
  • Microsoft Store: quick install, good for simple setups
  • Chocolatey: terminal-based install for package-manager workflows
  • Laragon: suitable if Python is part of your local web/dev stack

Linux options:

  • Debian/Ubuntu:
sudo apt update
sudo apt install python3 python3-pip
  • Fedora:
sudo dnf install python3 python3-pip
  • RHEL/CentOS (modern streams may use dnf):
sudo yum install python3
  • Build from source (advanced path when package repos are outdated):
wget https://www.python.org/ftp/python/3.12.2/Python-3.12.2.tgz
tar -xzf Python-3.12.2.tgz
cd Python-3.12.2
./configure --enable-optimizations
make -j4
sudo make altinstall

macOS options:

  • Homebrew:
brew install python
  • Official python.org installer if you prefer GUI installation
  • Xcode Command Line Tools (required by some build workflows):
xcode-select --install

Step 2 — Verify Python and pip

After installation, confirm both interpreter and package manager are available.

Interpreter checks:

python --version
python3 --version
py --version

Package manager checks:

python -m pip --version
python3 -m pip --version
py -m pip --version

Use whichever command works consistently on your machine.

Step 3 — Run a real sanity test

Create check_python.py:

import sys
import platform

print("Python version:", sys.version)
print("Executable:", sys.executable)
print("Platform:", platform.platform())

Run it:

python check_python.py

or:

python3 check_python.py

If this runs and prints valid details, your setup is healthy enough to continue.

Practical examples

Example 1 — Windows with Python Launcher (py)

Use explicit version selection to avoid ambiguity when multiple versions exist.

py -3.12 --version
py -3.12 -m pip --version

Expected output (sample):

Python 3.12.2
pip 24.x from ...site-packagespip (python 3.12)

This pattern is very useful on Windows because it binds command execution to a specific Python version.

Example 2 — Cross-platform safest pip usage

Instead of running pip directly, call pip through Python.

python -m pip install --upgrade pip
python -m pip list

Expected output (sample):

Package    Version
---------- -------
pip        24.x
setuptools 7x.x

Why this is better:

  • It guarantees pip belongs to the same interpreter you are using
  • It avoids “installed in wrong Python” issues

Common mistakes and how to avoid them

  • Installing Python on Windows without enabling PATH -> Re-run installer and select “Add Python to PATH”, then open a new terminal.
  • Using plain pip that points to another interpreter -> Use python -m pip (or py -m pip) consistently.
  • Having multiple Python versions but not knowing which one runs -> Use py -0p (Windows) or which python3 / command -v python3 (Linux/macOS).
  • Verifying only in one terminal type -> Check in the same terminal you will use for development (PowerShell, CMD, bash, zsh).
  • Installing from mixed sources without awareness -> Choose one primary source per machine when starting out.

Quick practice

  • Install Python using one method on your OS and record which method you used.
  • Run version checks and write down the exact command that works on your machine (python, python3, or py).
  • Create and run check_python.py, then save its output for future troubleshooting.

Key takeaways

  • Correct installation is a foundation step, not a formality.
  • Always verify interpreter and pip from terminal after installation.
  • Prefer Python 3.11+ / 3.12+ for this learning path.
  • Use explicit command patterns (python -m pip, py -3.12) to avoid version confusion.

Next step

Continue to Python Virtual Environments. In the next guide, you will isolate dependencies using venv, activate environments on each OS, and keep your projects reproducible.

No Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.