Home > other >  Why does cmd and powershell recognize "python" but not "py"?
Why does cmd and powershell recognize "python" but not "py"?

Time:12-14

I seem to be having the opposite issue as this user in this question. I can run python successfully, but py does not work for me. Overall, this is not a big deal but when I try to run code in VS Code, I get the error below:

py: The term 'py' is not recognized as a name of a cmdlet, function, script file, or executable program.

How can I either make VScode run python or change my system to accept py?

When I first downloaded Python, it was not placed into the path but I was able to fix that. I also confirmed that VS Code has selected the correct interpreter for Python in the same place.

EDIT: IMAGES Path directory Path used in enviroment

CodePudding user response:

When you write "python" on CMD or Powershell, it checks the given keyword("python" here) in all the directories in Environment Variables.

In the case of python, the directory mentioned for python in Environment Variables > Path, you will find "python.exe" and not "py.exe".

So your cmd or PowerShell recognizes python and not py.

  • Related