python3 -m pip install requestsSafer than calling `pip` directly on systems with multiple Python installs.
Use pip correctly across Python versions, venvs, pyenv-style setups, CI, and system interpreters.
python3 -m pip install requestsSafer than calling `pip` directly on systems with multiple Python installs.
python3.11 -m pip install requestsGreat when several minor versions are installed side-by-side.
python -c "import sys; print(sys.executable)"Useful before installing packages so you know where they will land.
python -m venv .venv && source .venv/bin/activate && python -m pip install --upgrade pipCreates an isolated environment, activates it, and upgrades pip inside it.
python -m pip install -r requirements.txtOnce the venv is active, `python -m pip` targets that environment.
python -m pip install --user httpieHelpful when you cannot write to system site-packages. Avoid inside a venv.
Override system package management protections when necessary.
python -m pip install --break-system-packages requestsUse cautiously. On many Linux distributions, using a venv is safer.
python -m pip install --upgrade pip setuptools wheelA common setup step before building or installing packages in automation.
python -m pip install --no-input -r requirements.txtUseful in CI systems or scripts where prompts would hang execution.
PIP_DISABLE_PIP_VERSION_CHECK=1 python -m pip install -r requirements.txtCan reduce noise and shave a small amount of time in CI.