Home > Article > Backend Development > Why Is CMD Redirecting to the Windows Store When I Enter 'Python'?
CMD Redirects to Windows Store When Entering 'Python': A Detailed Explanation and Resolution
When attempting to run Python code in Sublime Text 3, the unexpected message, "Python was not found but can be installed from the Microsoft Store," may appear, followed by CMD redirecting you to the Windows Store to download Python 3.7. This issue can arise seemingly without cause and despite correct Path environment variable settings.
Solution: Using Windows Settings to Remove Python Execution Aliases
To resolve this problem, navigate to the Windows search bar and search for "Manage app execution aliases." You will likely find two aliases for Python. Uncheck these aliases, allowing the standard "python" and "python3" aliases to be used.
Explanation of the Issue
This problem originates from the installation of Python after a fresh Windows installation. During setup, Windows creates aliases named python.exe and python3.exe in %USERPROFILE%AppDataLocalMicrosoftWindowsApps. These aliases are placed at the beginning of the "Path" environment variable list.
When entering "python" in CMD, the directories listed in the "Path" are searched from top to bottom. If Python was installed after a new Windows installation, the alias files will be found first, leading to the redirection to the Windows Store.
Additional Solution Options
If the previous solution does not resolve the issue, you can consider creating a new alias for Python using DOSKEY. Alternatively, you could delete the Windows user path environment variable that points to the alias files, although this may disrupt other applications that rely on execution aliases in that directory.
The above is the detailed content of Why Is CMD Redirecting to the Windows Store When I Enter 'Python'?. For more information, please follow other related articles on the PHP Chinese website!