CMD opens window store when I type python CMD opens window store when I type python python python

CMD opens window store when I type python


Use the Windows search bar to find "Manage app execution aliases". There should be two aliases for python, unselect them, this will allow the usual python aliases "python" and "python3". See image below.

enter image description here

I think we have this problem when installing python because in a new Windows installation the aliases are in the ON position as in image below. When turned on, Windows puts a empty or fake file named python.exe and python3.exe in the directory named %USERPROFILE%\AppData\Local\Microsoft\WindowsApps. This is the alias.

enter image description here

Then Microsoft put that directory at the top of the list in the "Path" environment variables.

enter image description here

When you enter "python" in cmd, it searches the directories listed in your "Path" environment variables page from top to bottom. So if you installed Python after a new Windows 10 install then get redirected to the Windows Store it's because there are two python.exe's, the alias in the App Execution Alias page, and the real one wherever you installed Python but cmd finds the App execution alias python.exe first because that directory is at the top of the Path.

I think the easiest solution is to just check the python.exe and python3.exe to OFF as I suggested before, which deletes the fake exe's. Based on this Microsoft Devblog https://devblogs.microsoft.com/python/python-in-the-windows-10-may-2019-update/ they stated they created this system partially for new python users specifically kids learning python in school that had trouble installing it. Creating this alias was to helps kids just starting python install it and focus on learning to code. I think Windows probably deletes those aliases if you install Python from the Windows App Store. What we are noticing is that they do not get deleted if you manually install from another source.

(Also the empty/fake python.exe is not really empty it says 0 KB in the screenshot but entering "start ms-windows-store:" in cmd opens the Windows App Store so it probably just has a line with that and a way to direct it to Python page.)

Finally, as Chipjust suggested you can create a new alias for python using something like DOSKEY as explained in this article for example:https://winaero.com/how-to-set-aliases-for-the-command-prompt-in-windows/


The main problem here is that the order in the path calls the windows from top to bottom, and that there is python.exe in %USERPROFILE%\AppData\Local\Microsoft\WindowsApps which is called first if there are no other python.exes in the PATH above that line.

To ensure that the correct python.exe is called, add the python installation folder (containing python.exe) to the PATH, above %USERPROFILE%\AppData\Local\Microsoft\WindowsApps

Here is an example:

  • To get to this location, click "Start" -> start typing "Env" -> Select "Edit the system environment variables" -> "Environment variables" -button -> Select the entry for "Path" in the upper list -> Click "Edit".

enter image description here

  • Python components should be at the top, as in step 5. If not, move up by pressing the button in step 6.


If python is already installed, then go to Apps & features from settings, select Python, then select modify.Again select modify and select Next:

select next

Then this window will appear:

select add python to environment variable

Select "add Python to environment variable" and click on the install button.Then again go to apps & features, click modify and then click repair.Now go to CMD and type python.Problem solved.