Developer Fix

“Python Was Not Found” on Windows 11, Windows 10, or VS Code? Fix It

Fix the common Python command error by checking installation, PATH, Windows aliases, and the interpreter selected inside Visual Studio Code.

Difficulty: Easy–Medium Time: 10–20 minutes Updated: July 2026 Windows & VS Code

You may see a message such as “Python was not found; run without arguments to install from the Microsoft Store” when Windows cannot locate a working Python installation. The cause is usually a missing installation, incorrect PATH, an app-execution alias, or the wrong interpreter in VS Code.

Quick answer: First run py --version. If it works, use py temporarily and repair the python command by disabling the Windows App Installer aliases or correcting PATH. If neither command works, install Python from Python.org and reopen every terminal.

Choose the correct fix from your test result

What happens Most likely cause Start here
py works, but python fails PATH or Windows app-execution alias Fix 2, then Fix 3
Both py and python fail Python is missing or the installation is incomplete Fix 1
Python works in Command Prompt but not VS Code Wrong interpreter or stale VS Code terminal Fix 4
Microsoft Store opens when you type python App Installer alias is taking priority Fix 2

Diagnose the “Python was not found” error first

Open a new Command Prompt or PowerShell window and run these commands:

python --version
py --version
where python
where py

If py works but python does not, Python is installed but the main command is missing from PATH or intercepted by a Windows alias. If where python points to Microsoft\WindowsApps, go directly to Fix 2.

Fix 1 — Install Python correctly

  1. Download Python from Python.org for Windows.
  2. Open the current Python Install Manager or the full Windows installer you downloaded.
  3. With the classic installer, tick Add python.exe to PATH before choosing Install Now.
  4. With the current Install Manager, finish setup and install the recommended stable runtime.
  5. Restart Command Prompt and VS Code.
  6. Run python --version and py --version again.
The PATH checkbox is tiny, but skipping it can create a surprisingly large headache.

Fix 2 — Disable Windows app execution aliases

  1. Open Settings → Apps → Advanced app settings → App execution aliases.
  2. If that path is different on your Windows build, search Settings for App execution aliases.
  3. Find the entries for python.exe and python3.exe.
  4. Turn off the Microsoft Store aliases.
  5. Close and reopen Command Prompt.

These aliases can redirect the Python command to the Microsoft Store instead of your actual Python installation. After switching them off, close all existing terminals and open a new one before testing again.

Fix 3 — Add Python to PATH manually

First locate your Python folder. Common locations include:

C:\Users\YOUR-NAME\AppData\Local\Programs\Python\Python3xx\
C:\Program Files\Python3xx\

Add both the Python folder and its Scripts folder to PATH:

C:\Users\YOUR-NAME\AppData\Local\Programs\Python\Python3xx\
C:\Users\YOUR-NAME\AppData\Local\Programs\Python\Python3xx\Scripts\
  1. Search Windows for Environment Variables.
  2. Open Edit the system environment variables.
  3. Click Environment Variables.
  4. Select Path under your user variables.
  5. Click Edit → New.
  6. Add the Python and Scripts paths.
  7. Click OK and restart the terminal.
Add the folder containing python.exe, not the full ...\python.exe filename. Do not delete unrelated PATH entries.

Confirm Windows now resolves the intended executable:

where python
python --version
python -c "import sys; print(sys.executable)"

Fix 4 — Select the correct interpreter in VS Code

  1. Open your project in VS Code.
  2. Press Ctrl + Shift + P.
  3. Search for Python: Select Interpreter.
  4. Choose the Python installation or virtual environment used by the project.
  5. Open a new terminal inside VS Code.

Then test:

python --version
python -m pip --version

If the environment is missing from the list, run Python Environments: Refresh All Environment Managers from the Command Palette. You can also choose Enter interpreter path and select the correct python.exe. The selected environment controls running, debugging, and Python language features in the workspace.

Fix 5 — Install the VS Code Python extension

  1. Open Extensions in VS Code.
  2. Search for Python.
  3. Install the official extension published by Microsoft.
  4. Reload VS Code.
  5. Select your interpreter again.

Fix 6 — Repair a virtual environment

A moved, deleted, or broken virtual environment can point VS Code to a Python executable that no longer exists. Recreate it from the project folder:

py -m venv .venv

Activate it:

.venv\Scripts\activate

Then reinstall the project packages:

python -m pip install -r requirements.txt

Fix 7 — Use the Python launcher

On Windows, the Python launcher often works even when the python command does not.

py your-script.py
py -m pip install package-name

To see the Python versions detected by the launcher, run:

py --list

If Python was working before but suddenly stopped

  1. Run where python to check whether WindowsApps now appears before your real Python folder.
  2. Recheck the app-execution aliases because a Windows update may have changed them.
  3. Open Installed apps, select Python, and use Modify or Repair when available.
  4. Remove only stale Python PATH entries that point to folders that no longer exist.
  5. Restart Windows if newly opened terminals still inherit the old PATH.

Common mistakes

FAQ

Why does “py” work but “python” does not?

The Python launcher is installed, but the Python executable is not available through PATH or is being overridden by a Windows alias.

Why does Python work in Command Prompt but not VS Code?

VS Code may be using a different interpreter or an old terminal session. Select the correct interpreter and open a fresh terminal.

Should I reinstall Python?

Reinstallation is often the quickest solution when the installation is incomplete or PATH settings are badly broken.

Why does typing Python open the Microsoft Store?

Windows is resolving an App Installer alias instead of your installed Python executable. Disable the python.exe and python3.exe aliases, reopen the terminal, and verify the result with where python.

Do I add python.exe itself to PATH?

No. Add the folder that contains python.exe and, when needed, its Scripts folder. PATH entries should be directories rather than the executable file.

Official references