CMD opens window store when I type python

前端 未结 9 1843
天涯浪人
天涯浪人 2020-11-27 17:31

Today when I tryed to run a simple code on Sublime Text 3, the following message appeard:

Python was not found but can be installed from the Microsoft

9条回答
  •  爱一瞬间的悲伤
    2020-11-27 18:20

    Two solutions:

    1. As ChipJust said it may be possible to use "py" as the new alias for python in Windows10.

    2. As explained here https://devblogs.microsoft.com/python/python-in-the-windows-10-may-2019-update/, use the search bar to find "Manage App Execution Aliases". There should be two aliases for python, see image, unselect them, which will allow the usual python aliases "python" and "python3"

    This works because Microsoft created the %USERPROFILE%\AppData\Local\Microsoft\WindowsApps dir for the Execution Alias system. There is a empty or "fake" *.exe in that dir because that essentially is the alias. What is really cool about MS's implementation, is that disabling the alias deletes the empty *.exe. Thus when you type the alias python, or spotify, etc, in cmd, Windows searches for the alias but won't find the empty *.exe anymore, and instead keeps searching the PATH until it finds the *.exe at the installed location if on the PATH. It is beneficial because you don't have to keep reodering the path for every new program you install that also has an alias, and based on the blog post by MS, it seems like this is the intended use.

提交回复
热议问题