Recently, numerous users have encountered an unusual behavior when attempting to run Python code: upon typing 'python' in CMD, it redirects them to the Microsoft Store to download Python 3.7. This issue has perennially arisen for unknown reasons, even without any significant changes or installations. Reinstalling Python and verifying the Path environment variable have proven ineffective.
To resolve this problem, we need to venture into the "Manage app execution aliases" section of the Windows search bar. Here, we will encounter two aliases for Python. By unselecting them, we can restore the original 'python' and 'python3' aliases.
The genesis of this issue lies in the Python installation process. Upon installation, Windows creates two empty files, 'python.exe' and 'python3.exe,' in the directory '%USERPROFILE%AppDataLocalMicrosoftWindowsApps.' This action overrides the default aliases for Python.
Windows subsequently places this directory at the top of the "Path" environment variables, ensuring that any search for "python" will prioritize the fake 'python.exe' and 'python3.exe' files over the actual Python installation.
The simplest solution to this predicament is to disable the App Execution Alias for Python. This action effectively removes the empty 'python.exe' and 'python3.exe' files, restoring the system to its intended functionality.
While it may be tempting to manually delete these fake EXE files, they will automatically regenerate upon system restart. Using the App Execution Aliases page offers a more persistent solution.
In addition to this primary solution, there are alternative workarounds:
The above is the detailed content of Why Does Typing 'python' in CMD Open the Windows Store?. For more information, please follow other related articles on the PHP Chinese website!