Fix ‘Python Is Not Recognized’ on Windows: PATH and Launcher Checks

Quick answer: The Windows command error means the shell cannot resolve a Python executable through the current installation, PATH, launcher, virtual environment, or command alias. Inspect the command resolution first, then change the smallest environment setting that fixes the intended runtime.

Python Pool infographic showing a Windows terminal resolving the python command through PATH, the py launcher, or an activated virtual environment
Windows must resolve Python through PATH, the py launcher, or an activated environment; inspect which command is found before reinstalling blindly.

The Windows error 'python' is not recognized as an internal or external command means Command Prompt or PowerShell cannot find a python.exe command in the current PATH.

The quickest fix is to try the Python launcher first:

py --version

If py works, Python is installed and you can run scripts with:

py script.py
py -m pip --version

If neither python nor py works, install Python or repair the PATH entries.

Why Windows says python is not recognized

Windows searches directories listed in the Path environment variable when you type a command. If Python’s executable directory is not listed there, Windows cannot find python.

The error can happen when:

  • Python is not installed.
  • Python is installed, but its folder is not in Path.
  • You installed Python but did not restart the terminal.
  • The Microsoft Store app execution alias is intercepting python.
  • You have multiple Python installations and Windows is finding the wrong one.

1. Check python and py commands

Run these commands in PowerShell or Command Prompt:

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

If py --version works but python --version fails, you can keep using py, or you can add Python’s command directory to Path.

The official Python on Windows documentation now recommends the Python Install Manager for Windows. It also explains that python, py, and pymanager should be available after installation, depending on your setup.

2. Install Python correctly on Windows

Download Python from python.org/downloads or use the Microsoft Store option described in Python’s Windows documentation.

After installation, close every open terminal and open a new one. Then run:

python --version
py --version

If you are using the classic Windows installer and it offers an Add Python to PATH checkbox, enable it before installing. If you already installed Python without PATH, either modify the installation or add the path manually.

Python Pool infographic showing a terminal command, PATH entries, Python executable, and lookup
The shell finds an executable by searching PATH entries in order.

3. Add Python to PATH manually

If py works, use it to find the actual Python executable:

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

The output may look like one of these paths:

C:UsersYourNameAppDataLocalProgramsPythonPython312python.exe
C:UsersYourNameAppDataLocalPythoninpython.exe

Add the directory that contains python.exe to your user Path. If you also want command-line scripts such as pip, add the matching Scripts directory too.

C:UsersYourNameAppDataLocalProgramsPythonPython312C:UsersYourNameAppDataLocalProgramsPythonPython312Scripts

Steps:

  1. Press Start and search for Edit environment variables for your account.
  2. Select Path under user variables.
  3. Click Edit, then New.
  4. Add the Python directory and, if needed, the Scripts directory.
  5. Save the changes and open a new terminal.

Python’s Windows documentation notes that the Python Install Manager may use %LocalAppData%Pythonin for command aliases and that each runtime has its own scripts directory. Use the paths on your machine, not a copied path from someone else’s screenshot. The same command-resolution principle appears on macOS and Linux when zsh cannot find Conda; Fix zsh: command not found: conda covers that shell-specific case.

4. Fix Microsoft Store app execution aliases

If typing python opens the Microsoft Store or does nothing useful, check Windows app execution aliases.

  1. Open Start.
  2. Search for Manage app execution aliases.
  3. Find the Python aliases.
  4. Disable and re-enable them, or disable the Store alias if it conflicts with your installed Python.

The Python Windows troubleshooting section specifically mentions app execution aliases when python gives a command-not-found style error or opens the Store app.

5. Use python -m pip instead of plain pip

After Python works, use pip through the same interpreter:

python -m pip --version
python -m pip install requests

If python still does not work but py does, use:

py -m pip --version
py -m pip install requests

This avoids a common problem where pip points to a different Python installation. If pip later reports package metadata warnings, see our guide to WARNING: Ignoring invalid distribution in pip.

Python Pool infographic comparing python, py launcher, installed versions, and selected interpreter
The Windows py launcher can select among installed Python versions.

6. Use virtual environments for projects

Once Python is installed, create a separate environment for each project:

python -m venv .venv
.venvScriptsActivate.ps1
python -m pip install --upgrade pip

Python’s Windows documentation recommends virtual environments for project isolation. The official venv documentation covers the module in detail. If you need to clean one up later, read remove Python venv safely.

Common fixes checklist

  • Close and reopen the terminal after installing Python or editing Path.
  • Try py --version if python --version fails.
  • Use where python to see which executable Windows finds.
  • Add both the Python install directory and the Scripts directory to Path.
  • Check Manage app execution aliases if Python opens the Store.
  • Use python -m pip or py -m pip, not a random pip command.

If you are working in an older Windows Python IDE, our PythonWin IDE guide may help identify which interpreter the tool is using. If your issue is just terminal clutter, see how to clear the Python shell.

Python Pool infographic mapping a project through venv activation to a local Python executable
Activating a virtual environment puts its interpreter and scripts first on PATH.

Conclusion

To fix 'python' is not recognized as an internal or external command, confirm whether py works, install Python if needed, add the correct Python and Scripts folders to Path, refresh app execution aliases, then reopen your terminal. For package installs, prefer python -m pip so pip runs under the Python interpreter you intend to use. Windows PATH failures have a Unix counterpart; Fix usr/bin/env Python Not Found fixes missing /usr/bin/env interpreters, shebang names, permissions, and environments.

Check What The Shell Finds

Use the Windows command-resolution tools and inspect the current PATH before reinstalling. A stale terminal may not contain a newly changed environment, while an alias can intercept the expected command.

Try The Python Launcher

The py launcher can list or invoke installed Python versions on many Windows setups. It helps distinguish a missing PATH entry from a missing installation, but its availability depends on how Python was installed.

Activate The Intended Environment

A virtual environment places its own Python and Scripts directory first when activated. Confirm the prompt and interpreter path, and do not mix packages from one environment with an executable from another.

Python Pool infographic testing where python, PATH order, aliases, terminal restart, and validation
Check command resolution, PATH order, app aliases, terminal restart, and interpreter identity.

Repair PATH Deliberately

Add the actual Python installation and Scripts directories only when that matches the machine’s policy. Avoid copying another computer’s path, and open a new terminal after changing user or system variables.

Account For Installers And Aliases

Microsoft Store aliases, per-user installations, corporate restrictions, and multiple versions can change command behavior. Record the installation source and version so the fix is repeatable.

Test The Complete Workflow

Test python or py, version output, pip association, virtual-environment activation, IDE terminals, scheduled jobs, and a fresh shell. Document the command that the project standardizes on.

The official Python on Windows documentation covers installation and launcher context. Related Python Pool references include tests and configuration mappings.

For related environment troubleshooting, compare workflow checks, configuration values, and safe command diagnostics when repairing Python on Windows.

Frequently Asked Questions

Why does Windows say Python is not recognized?

The executable is not installed, its directory is missing from PATH, the terminal has stale environment variables, or an alias is intercepting the command.

What is the Windows py launcher?

The py launcher can locate installed Python versions and is often a useful diagnostic or invocation command on Windows.

Should I add Python to PATH?

Add the correct installation and Scripts directories when that matches your deployment policy, then open a new terminal so it receives the updated environment.

Why does Python work in one terminal but not another?

Different terminals, users, virtual environments, or launch configurations can have different PATH values and command aliases.

Subscribe
Notify of
guest
3 Comments
Oldest
Newest Most Voted
Dahian
Dahian
5 years ago

I’ve done this, and I still get the same error.

Dahian Polo
Dahian Polo
5 years ago
Reply to  Python Pool

Thanks. Yes, on the cmd I get phyton is not recognize…Howver, upon following your steps, I can see is added in the path in both the top and the bottom options