which pythonA quick first check after activating a venv.
Diagnose activation problems, broken pip, wrong interpreter selection, PATH confusion, and environment drift in Python virtual environments.
Find out why the shell is resolving the wrong Python or pip.
which pythonA quick first check after activating a venv.
which pipUseful when `pip` appears to install into the wrong location.
command -v pythonAnother common way to inspect command resolution in POSIX shells.
python -c "import sys; print(sys.executable)"This is often more trustworthy than assumptions based on PATH alone.
python -m pip install -r requirements.txtThis is a best practice when multiple Python installations are present.
Handle shell and Windows policy issues.
source .venv/bin/activateThe most common activation command on POSIX systems.
source .venv/bin/activate.fishUse the shell-specific script when you are not using bash/zsh.
.venv\Scripts\Activate.ps1Standard PowerShell activation command for a venv.
Set-ExecutionPolicy -Scope CurrentUser RemoteSignedA common resolution when PowerShell blocks `Activate.ps1`.
rehashUseful when a shell keeps remembering an old command location after activation.
Recover from missing pip or broken packaging tools.
python -m ensurepip --default-pipUse this when pip is missing after environment creation or corruption.
python -m ensurepip --upgradeUseful after partial uninstall or a broken pip state.
python -m pip install --upgrade --force-reinstall pip setuptools wheelA common recovery step when package operations start behaving strangely.
python -m pip cache purgeUseful when stale caches appear to contribute to install failures.
Delete and recreate when the environment is no longer trustworthy.
rm -rf .venv && python -m venv .venv && source .venv/bin/activate && python -m pip install -U pip setuptools wheel && python -m pip install -r requirements.txtOften the fastest and cleanest fix when a venv becomes inconsistent.
Remove-Item -Recurse -Force .venv; py -m venv .venv; .venv\Scripts\Activate.ps1; python -m pip install -U pip setuptools wheel; python -m pip install -r requirements.txtPowerShell equivalent of a full environment rebuild.
python -c "import pkgutil; print('requests' in [m.name for m in pkgutil.iter_modules()])"A quick example of checking whether an expected package is visible after reinstall.