How to fix "'python' is not recognized as an internal or external command"

Researched, not yet tested: compiled from the Python documentation for Windows (Python 3.15) as of 29 November 2026; we didn't test on a Windows PC. Check the commands against your setup.

Windows can’t find python. Try the Python launcher first, which often works when python doesn’t:

py --version

If that prints a version, Python is installed and you can use py wherever a guide says python. To make python work too, or if py isn’t found either, follow the steps below.

We didn’t test this on a Windows PC. The steps come from the Python documentation for Windows, which covers the Python install manager (the current installer) and the older full installer.

The message

In Command Prompt:

'python' is not recognized as an internal or external command,
operable program or batch file.

PowerShell words it differently, starting The term 'python' is not recognized as the name of a cmdlet. Both mean the same thing. Windows searched every folder in your PATH variable and didn’t find a python program.

Step 1: check whether Python is installed

Open Start and look for “Python” under Installed apps. If it isn’t there, install it. The Python docs say the Python install manager is available from python.org/downloads or the Microsoft Store, and that after installing it the python, py and pymanager commands should work. Open a new terminal afterwards.

The docs also note that the older full installer is deprecated since Python 3.14 and won’t be produced for Python 3.16 or later.

Step 2: check the app execution aliases

Windows routes some commands through aliases. The Python docs’ troubleshooting table says that when python gives a “command not found” error or opens the Store:

  1. Click Start and open “Manage app execution aliases”.
  2. Check that the aliases for “Python (default)” are turned on. If they already are, turn them off and on again to refresh them.
  3. If you installed Python another way and the Store keeps opening, turn off the python.exe and python3.exe aliases that point to the Microsoft Store so they stop catching the command.

The docs also say your PATH must still include %UserProfile%\AppData\Local\Microsoft\WindowsApps, which Windows adds by default. If it was removed, the aliases can’t be found.

Step 3: add Python to PATH

If you used the older full installer and left the PATH option unticked, Python is installed but Windows doesn’t know where. Find the folder:

py -c "import sys; print(sys.executable)"

Then add that folder, and the Scripts folder inside it, to PATH:

  1. Search Start for “Edit environment variables for your account”.
  2. Select Path and click Edit. Click New and paste the folder.
  3. Add the Scripts folder the same way (this is where pip lives).
  4. Click OK and open a new terminal.

Alternatively, run the full installer again, choose Modify and turn on the option that adds Python to the environment variables.

For the Python install manager, the docs say it may offer to add %LocalAppData%\Python\bin to PATH when you first install a runtime. This is optional if you’re happy using py.

Step 4: open a new terminal and check

PATH changes only reach windows opened after the change. Close Command Prompt, PowerShell or VS Code completely and reopen it, then:

where python
python --version

where python lists every python.exe Windows finds, in order. If the first one is inside WindowsApps and it opens the Store, go back to Step 2.

If python and py start different versions

The Python docs suggest removing older runtimes (or turning off their PATH options with Modify under Installed apps) and checking that the python.exe alias is set to “Python (default)”. py list shows which runtime the install manager treats as the default.

If python works but pip doesn’t, see pip is not recognized. On a Mac, the equivalent error is zsh: command not found: python.

FAQ

Why is Python not recognized in my command prompt?

Windows looks for python.exe in the folders listed in your PATH variable and didn't find it. Either Python isn't installed, it was installed without adding it to PATH, or the app execution alias for python is off. The py command often works even when python doesn't.

How do I fix not recognized as an internal or external command?

The message means Windows can't find the program. Install it if it's missing. If it is installed, add its folder to PATH (search Start for "Edit environment variables for your account") and open a new terminal. Already-open windows keep the old PATH.

How do I activate Python in CMD?

There's nothing to activate for Python itself: type python or py and press Enter to start it, and exit() to leave. For a project's virtual environment, run .venv\Scripts\activate in CMD (or .venv\Scripts\Activate.ps1 in PowerShell).

Why does typing python open the Microsoft Store?

Windows includes app execution aliases named python.exe and python3.exe that open the Store when no Python is installed. Install Python, or open "Manage app execution aliases" from Start and switch those aliases off if you installed Python another way.