What this error means

pip: command not found means Python is using an interpreter, package environment, certificate store, or virtual environment that does not match what the script expects.

Common causes

  • pip is not installed
  • Python scripts directory is not in PATH
  • Wrong Python version is active
  • Virtual environment was not activated

Copy-paste commands

Check Python version

python3 --version

Check pip target

python -m pip --version

List installed packages

python -m pip list

Create a virtual environment

python -m venv venv

Activate on macOS/Linux

source venv/bin/activate

Quick fixes

  1. Check the active interpreter with python3 --version.
  2. Use python -m pip so pip targets the interpreter that runs the code.
  3. Use python -m pip first, then install or repair pip for the active interpreter if needed.
  4. Recreate the virtual environment if the interpreter version changed.

Step-by-step troubleshooting

  1. Confirm the failing traceback contains pip: command not found.
  2. Run python -m pip --version and verify the path belongs to the expected environment.
  3. Activate the virtual environment, then rerun the same version and pip checks.
  4. Install packages with python -m pip install <package> rather than a bare pip command.
  5. Retry the smallest script or import that produced the error.

Platform-specific fixes

macOS

  • If system Python and Homebrew Python both exist, use python3 -m pip from the interpreter you run in production.

Linux

  • On Debian/Ubuntu, install virtual environment support with sudo apt install python3-venv when ensurepip is missing.

Windows

  • Use py -m pip --version and py -m venv venv when the Python launcher is installed.

Real-world fixes

  • If imports fail after installation, the package was likely installed into a different interpreter.
  • If SSL fails only in Python, update the CA bundle used by Python before disabling verification.
  • Use python -m pip first, then install or repair pip for the active interpreter if needed.

How to prevent it

  • Use a virtual environment per project.
  • Record dependencies in requirements.txt, pyproject.toml, or the project lockfile.
  • Use python -m pip in documentation and CI scripts.