0

I was trying to run the command "python get-pip.py" to install the pip package manager but I got the "Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings" error. The issue is that I do have python installed. I have the file C:\Windows\py.exe which means its installed.

I assume the issue is something related to the System Environment Variables. But what exactly do I need to modify?

Codex
  • 101
  • 1
  • 11
  • You need to add Python to the PATH variable – S.B Jan 24 '22 at 07:18
  • refer to https://www.architectryan.com/2018/03/17/add-to-the-path-on-windows-10/ and add the directory containing the python executable to path – Scene Jan 24 '22 at 07:20
  • "I have the file C:\Windows\py.exe which means its installed." Not necessarily. What happens when you run `py` directly? It can, I believe, be left behind after all installed Pythons are removed. That said, what you describe sounds like a very common problem. It happens because Windows 10 wants you to use the Microsoft Store to install Python, and comes pre-loaded with stubs advertising this, but that process conflicts with the normal installation route. IMO it was very inconsiderate of Microsoft. – Karl Knechtel Jan 24 '22 at 07:22
  • @KarlKnechtel If i run py.exe it opens the python terminal and lists its version above – Codex Jan 24 '22 at 07:23
  • Once again. py.exe is not python.exe.. doesn’t matter what py.exe does in relation to the error. When running “python get-pip.py” in the terminal, *there is no `py.exe` involved when the shell attempts to resolve `python`* – user2864740 Jan 24 '22 at 07:24
  • https://renenyffenegger.ch/notes/Windows/dirs/Windows/py_exe – DarkKnight Jan 24 '22 at 07:24
  • 1
    @user2864740 `py.exe` [is supposed to be](https://www.python.org/dev/peps/pep-0397/#discussion) in `C:\Windows`, and its presence *normally does* indicate an installed Python. By running it, OP gains access to an installed Python, which is the purpose of that program - to choose from among installed Pythons. – Karl Knechtel Jan 24 '22 at 07:26
  • 1
    OP: When you use `py`, that program uses its own logic to try to find an installed version of Python on your computer. When you use `python`, the shell uses its normal logic to look up Python, which depends on the PATH. (The same is true for `py`, but by design, it is installed in a way that it will always be found.) The linked duplicate explains in detail. – Karl Knechtel Jan 24 '22 at 07:27

0 Answers0