This lesson on Installing Python is hands-on and example-driven. You will verify whether Python is currently installed on your operating system, download the standard binary from python.org, and configure system PATH variables appropriately. This ensures your command-line interface can reliably locate and execute the Python interpreter across data engineering workflows.
What You'll Be Able To Do
- Verify existing Python installations using the terminal or PowerShell.
- Distinguish between the Microsoft Store Python distribution and the official python.org installer.
- Execute the official Windows installer while configuring the system PATH checkbox.
- Evaluate system risks associated with adding multiple Python interpreter versions to PATH.
- Recognize the necessity of virtual environments for isolating project-specific dependencies.
Detailed Concept Walkthrough
1. Verifying Pre-Existing Python Installations
Before running a new installer, you must query your terminal to determine if an interpreter binary is already mapped to your environment. Running conflicting installations simultaneously can cause execution ambiguities across system shells.
- Mechanism: Opening PowerShell and running the version check queries the active operating system shell for an executable registered under the alias
python. - Execution Flow: If Python is found, the terminal outputs the exact release version number; if missing, Windows may redirect to the Microsoft Store or raise a command-not-found error.
- Best Practice: Always inspect the version output before installing a new binary to avoid overlapping interpreters in shared execution paths.
# Open Windows PowerShell or Command Prompt
# Check if an interpreter is currently registered
python --version
# Expected output if installed:
# Python 3.12.x
Key Takeaway: Always verify whether an interpreter already exists in your shell before initiating a fresh installation.
2. Official Distribution Versus App Store Package
The official distribution from python.org provides unrestricted file system and binary access needed for engineering tools, unlike sandboxed app store versions. App store distributions often introduce execution restrictions for advanced developer workflows.
- Mechanism: The python.org installer unpacks standard CPython binaries, standard libraries, and system linkers directly onto the local drive.
- Under the Hood: Microsoft Store packages run within sandboxed application containers, which can restrict write permissions, local path modifications, and compiled C-extension execution.
- Best Practice: Download the official Windows executable installer directly from python.org to ensure full tooling compatibility.
# Navigation target for standard binaries:
# URL: https://www.python.org/downloads/
# Verify downloaded installer integrity from PowerShell:
Get-FileHash -Path .\python-installer.exe -Algorithm SHA256
Key Takeaway: Use the standard python.org installer to prevent containerized permission issues inherent to store packages.
3. Understanding System PATH Environment Variables
The system PATH is an operating system variable listing directories where the shell searches for executable programs when commands are typed. Adding Python to PATH registers the interpreter location globally across all terminal sessions.
- Mechanism: When you type a command like
pythonornotepad, the OS traverses every directory listed in PATH until it finds a matching binary file. - Under the Hood: Selecting 'Add Python to PATH' in the installer appends the Python installation and
Scriptsdirectories to the Windows environment table. - Best Practice: Enable PATH registration on clean, single-interpreter setups, but manage PATH manually if you support legacy multi-version environments.
# Example of launching registered executables via PATH
notepad
excel
# Launch Python interactive REPL via PATH
python
Key Takeaway: PATH registration enables global command execution from any directory but requires caution when multiple versions coexist.
4. Dependency Isolation and Virtual Environments
Global Python installations share a single site-packages directory, causing version collisions between conflicting project libraries over time. Virtual environments isolate project dependencies to keep the underlying base installation clean and stable.
- Mechanism: Virtual environments create isolated directory trees containing separate copies or symlinks of the Python interpreter and local package registries.
- Under the Hood: Activating an environment updates shell environment variables to prioritize the isolated binary directory over the base PATH.
- Best Practice: Never install project-specific data engineering packages into the global interpreter; create a dedicated environment per project.
# Standard workflow for project isolation
# Create a self-contained virtual environment
python -m venv .venv
# Activate the environment on Windows PowerShell
.\.venv\Scripts\Activate.ps1
Key Takeaway: Pair a clean global installation with isolated virtual environments for every distinct project.
Topics Covered in Installing Python
- Introduction and Pre-Check Overview (0:00 - 0:25) — The instructor outlines installation approaches and stresses checking for pre-existing Python binaries.
- Verifying Existing Installations (0:26 - 0:45) — PowerShell is opened to execute the version check command against the local operating system.
- Official Installer Download (0:46 - 1:15) — The instructor navigates to python.org to download the standard executable rather than the app store build.
- PATH Mechanics and Usage (1:16 - 1:55) — The concept of PATH is explained as a system shortcut mapping terminal commands to binary locations.
- Managing PATH and Versioning (1:56 - 2:30) — Guidance is given on when to check or uncheck the PATH configuration option during installation.
- Introduction to Virtual Environments (2:31 - 3:00) — The instructor highlights using virtual environments to prevent messy dependency collisions in future projects.
Python Cheat Sheet
-
python --version— Checks the currently active Python interpreter versionpython --version -
python— Launches the interactive Python REPL terminal sessionpython -
notepad— Demonstrates executing an application registered in PATHnotepad -
python -m venv <dir>— Initializes a localized virtual environment directorypython -m venv .venv
Comparison Table
| Feature / Attribute | Official python.org Installer | Microsoft Store Distribution |
|---|---|---|
| Execution Environment | Direct native OS access | Sandboxed container execution |
| PATH Customization | Explicit installer checkbox option | Automatic sandboxed app alias |
| Data Engineering Fit | Fully compatible with tooling | Restrictive for complex packages |
| Multi-Version Control | Configurable directory structures | Managed via Windows Store |
Common Pitfalls
- Mistake: Installing Python without checking if an older version exists. Avoid: Run python --version in PowerShell before downloading to identify active interpreters.
- Mistake: Overlooking the Add Python to PATH installer checkbox on clean machines. Avoid: Check the box explicitly on the first screen of the graphical installer.
- Mistake: Adding multiple conflicting Python versions to PATH without tooling. Avoid: Leave PATH unchecked when installing secondary versions and manage paths manually.
- Mistake: Installing all project libraries into the global base interpreter. Avoid: Initialize an isolated virtual environment for every separate code project.
FAQs
- What happens if I forget to check 'Add Python to PATH' during installation?
Typing
pythoninto PowerShell will result in a command-not-found error, requiring you to re-run the installer and select 'Modify' to enable PATH. - Why is the Microsoft Store version of Python considered restrictive? Store apps operate within isolated application sandboxes, which can block necessary low-level file modifications and C-extension compilations.
- Should I add Python to PATH if I already have Python installed? No, adding multiple unmanaged Python installations to PATH causes version conflicts when the terminal resolves conflicting binary names.