On Windows, pip is bundled automatically with all official Python 3.4+ installers from python.org—you just need to ensure “Add python.exe to PATH” and “pip” are checked during installation (or run py -m ensurepip --upgrade if it was omitted).

1. Installing pip During Python Setup (Recommended)

  1. Download the official Windows installer from python.org/downloads.
  2. On the very first installer screen, check “Add python.exe to PATH” at the bottom.
  3. Click Customize installation and verify that “pip” and “py launcher” are checked under Optional Features.
  4. Complete the installation, open a new Command Prompt or PowerShell window, and verify both pip and PATH:
# Verify pip version and confirm it maps to your Python installation
py -m pip --version
pip --version

2. Fixing a Missing pip or PATH Issue on an Existing Installation

If Python is already installed on Windows but typing pip returns 'pip' is not recognized as an internal or external command:

# Step 1: Bootstrap or repair pip using Python's built-in ensurepip module
py -m ensurepip --upgrade

# Step 2: Upgrade pip to the latest release
py -m pip install --upgrade pip
  • Adding Scripts\ to Windows PATH manually: If py -m pip works but bare pip fails, Windows is missing Python’s Scripts folder in your environment variables. Find its exact location and add it to your User PATH:
    # Print the exact Scripts directory path (e.g., C:\Users\<You>\AppData\Local\Programs\Python\Python312\Scripts)
    py -c "import sys, os; print(os.path.join(sys.prefix, 'Scripts'))"
    
    Open Start → search “Edit environment variables for your account” → select Path → Edit → New → paste the Scripts folder path (along with the parent Python folder path) → click OK, then restart your terminal.

3. Configuring pip on Windows (pip.ini)

You can set persistent default options—such as custom package indexes, timeouts, or trusted hosts—by creating a pip.ini configuration file:

# Create the per-user pip config directory and open pip.ini
mkdir "$env:APPDATA\pip" -Force
notepad "$env:APPDATA\pip\pip.ini"

Add your preferred settings inside pip.ini:

[global]
timeout = 60
no-cache-dir = false

[install]
upgrade-strategy = only-if-needed
  • Verify active configuration: Run py -m pip config list or py -m pip config debug in PowerShell to inspect which pip.ini locations Windows is reading from.

Quick Troubleshooting & Command Reference

Scenario / Issue Windows Command Purpose
Safe package installation py -m pip install <package> Guarantees pip installs into the exact Python interpreter invoked by py.
pip missing completely py -m ensurepip --upgrade Installs the bundled pip wheel without needing internet access.
'pip' is not recognized Add ...\Python3XX\Scripts to User PATH Allows running pip directly without the py -m prefix.
Permission denied error Use a virtual environment (py -m venv .venv) Isolates project dependencies and avoids modifying system-wide folders.