Multiple Python versions are normal. The problem begins when terminals, VS Code, pip, and file associations select different ones. That can produce missing-package errors, incompatible syntax, or scripts that behave differently depending on how they are launched.
Do not uninstall versions blindly. First map every command to its actual executable, then decide which version should be the system default and which should remain project-specific.
Identify every Python Windows can see
where python
where py
py -0p
python -c "import sys; print(sys.version); print(sys.executable)"
where python may return several paths. Windows normally launches the first one. py -0p shows versions registered with the Python Launcher.
Fix 1 — Put the intended version first in PATH
- Open Edit environment variables for your account.
- Edit the User Path.
- Move the desired Python folder and Scripts folder above older Python entries.
- Remove only paths that point to versions you no longer use or folders that no longer exist.
- Open a new terminal and test again.
Fix 2 — Check User PATH and System PATH separately
A system-wide Python entry can override expectations, especially on shared computers or machines configured by development tools. Compare both lists. A user-level entry is usually safer for a personal installation because it does not affect other accounts.
Fix 3 — Use the Python Launcher for explicit versions
py -3.12 script.py
py -3.11 -m venv .venv
py -3.12 -m pip install requests
Version-specific launcher commands are the cleanest way to create environments and install packages when several interpreters must remain installed.
Fix 4 — Recreate virtual environments made with an old version
A virtual environment stores a reference to the interpreter used when it was created. Changing the global PATH does not upgrade an existing environment.
py -3.12 -m venv .venv
.venv\Scripts\activate
python --version
Before deleting an old environment, save its dependencies if needed:
python -m pip freeze > requirements.txt
Fix 5 — Align VS Code with the project interpreter
- Open the project folder.
- Run Python: Select Interpreter.
- Choose the intended virtual environment or Python version.
- Open a new integrated terminal.
- Run
python -c "import sys; print(sys.executable)".
The status bar, terminal, debugger, and Pylance should all point to the same environment.
Fix 6 — Check file associations for double-clicked scripts
Double-clicking a .py file may use a different registered interpreter than Command Prompt. Right-click a script, choose Open with, and verify the selected Python application. For reliable development, run scripts from a terminal or IDE instead of relying on file associations.
Fix 7 — Make pip target the intended version
python -m pip --version
py -3.12 -m pip --version
The output includes the package directory and Python version. Install with the interpreter-qualified form rather than assuming the standalone pip command is correct.
FAQ
Why does Command Prompt show one version and VS Code another?
VS Code can select an interpreter directly from workspace settings, independent of the terminal’s default PATH.
Can multiple Python versions share packages?
Not automatically. Each interpreter and virtual environment has its own package location.
Should I change the default version globally?
Only when most projects use it. Project-specific virtual environments are safer than constantly changing the global default.