Install Python on Windows

Introduction

This chapter walks you through how to install Python on Windows in a clean, production-friendly way. You will learn the exact setup steps, how to verify the installation, and how to avoid common environment issues. This is important because many later Python errors are caused by incorrect installation or PATH configuration.

Prerequisites

  • A Windows 10 or Windows 11 machine
  • Local administrator permissions (recommended)
  • Basic command-line knowledge in PowerShell or Command Prompt
  • Stable internet connection to download installers

Choose the Right Python Version

Before installation, decide which version you should use. For most new projects, Python 3.12 is a strong default unless your team requires another version.

Recommended guidance:

  • Use Python 3 for all new development
  • Match your team version for shared projects
  • Avoid Python 2 and unsupported Python 3 versions
  • Prefer the official installer from python.org

Install Python from the Official Installer

Use the official Windows installer from python.org.

Installation steps:

  1. Download the latest stable Python 3 installer for Windows
  2. Run the installer
  3. Enable Add Python to PATH on the first setup screen
  4. Click Customize installation if you need advanced options
  5. Keep pip and standard library options enabled
  6. Complete installation and close the installer

Common Issues:

  • Problem: python command is not recognized after install.
  • Likely cause: PATH was not updated during installation.
  • Fix steps:
    1. Re-run installer and enable Add Python to PATH
    2. Restart terminal after installation
    3. Validate with python --version and pip --version

Verify Installation in PowerShell

After installation, verify that Python and pip are available globally.

powershell
# Check Python version from PATH
python --version
 
# Check pip version from PATH
pip --version

Expected outcome:

  • Commands return version strings instead of command-not-found errors
  • Version is the one you intended to install

Congratulations – you just tamed the Python. 🐍 No more 'python' is not recognized heart attacks. Your shell now knows where Python lives, and pip is ready to ship. Go ahead, treat yourself to a coffee (or a debugging session, you weirdo). You've earned it.

FAQ

Should I install Python from the Microsoft Store?

It can work for basic use, but the official python.org installer is usually more predictable for professional development. It gives clearer control over PATH and installation options.

Why do I need a virtual environment on Windows?

Virtual environments keep dependencies isolated per project. This prevents version conflicts and makes your setup reproducible across teammates and CI.

What is the difference between python and py on Windows?

python uses the interpreter resolved by PATH. py is the Python Launcher and can target specific versions, such as py -3.12, which is useful when multiple versions are installed.

How do I uninstall an old Python version safely?

Remove it from Apps & Features, then verify PATH entries and keep only active versions. Finally, check with py -0p and python --version.