Home > Backend Development > Python Tutorial > Why Does Typing 'python' in CMD Open the Windows Store?

Why Does Typing 'python' in CMD Open the Windows Store?

Mary-Kate Olsen
Release: 2024-11-26 09:29:10
Original
245 people have browsed it

Why Does Typing

CMD Opens Windows Store When I Type 'python': A Comprehensive Solution

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:

  1. Create a new alias for Python using DOSKEY or similar tools.
  2. Delete the user path environment variable pointing to the alias files, but be aware that this may disrupt other applications with execution aliases.

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!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template