On Windows the message often reads “pip is not recognized as an internal or external command”. On macOS or Linux it may say “command not found: pip”. This does not always mean pip is missing. It may simply not be available as a standalone command.
Fix 1 — Use pip through Python
Try:
python -m pip --version
On systems where Python 3 uses a separate command:
python3 -m pip --version
Install a package with:
python -m pip install package-name
This is the preferred method because it guarantees that pip belongs to the Python interpreter you invoked. It also avoids many PATH-related problems.
Fix 2 — Confirm which Python VS Code is using
python -c "import sys; print(sys.executable)"
Compare that path with the interpreter selected in VS Code. If they are different, use Python: Select Interpreter, choose the intended environment, and open a new terminal.
Fix 3 — Install pip into the active Python
If python -m pip reports that pip is unavailable, run:
python -m ensurepip --upgrade
Then update pip:
python -m pip install --upgrade pip
Some managed or minimal Python installations may not include ensurepip. In that case, install pip using the package manager recommended for your operating system or reinstall Python from a trusted source.
Fix 4 — Activate the virtual environment first
Windows:
.venv\Scriptsctivate
macOS or Linux:
source .venv/bin/activate
Then run:
python -m pip --version
The output location should point inside .venv. If it points to a global Python folder, the environment is not actually active or VS Code selected a different interpreter.
Fix 5 — Add the Python Scripts folder to PATH on Windows
Find the user base location:
python -m site --user-base
The corresponding Scripts directory is where commands such as pip may live. Add the correct Python folder and its Scripts folder to your user PATH, then fully restart VS Code.
Do not add several unrelated Scripts directories. That can make pip install into one Python while python runs another.
Fix 6 — Try the Python launcher on Windows
py -m pip --version
py -m pip install package-name
The py launcher is useful when the python command is missing or points to a Microsoft Store alias. You can target a version when necessary, for example py -3.12 -m pip.
Fix 7 — Avoid using sudo with pip unless you understand the environment
On Linux or macOS, installing Python packages globally with elevated permissions can interfere with system-managed Python. Prefer a virtual environment, pipx for standalone applications, or the operating system’s package manager where appropriate.
Fix 8 — Check whether VS Code terminal inherited old PATH values
After changing PATH or installing Python, close every VS Code window and open it again. A terminal created before the change will not automatically receive the new environment variables.
Verify that pip and Python match
python -m pip --version
python -c "import sys; print(sys.executable)"
Both paths should refer to the same Python installation or virtual environment. Once they match, install packages with python -m pip and test the import.
FAQ
Is python -m pip different from pip?
It runs the pip module through a specific Python interpreter, which makes environment selection explicit and safer.
Why did pip stop working after installing another Python version?
The new installation may have changed PATH order, leaving python and pip connected to different versions.
Should I reinstall VS Code?
Usually not. pip belongs to Python, not VS Code. Fix the Python environment or PATH first.