Python Command Not Working in Command Prompt

Python command not working in command prompt

It finally worked!!!

I needed to do things to get it to work

  1. Add C:\Python27\ to the end of the PATH system variable
  2. Add C:\Python27\ to the end of the PYTHONPATH system variable

I had to add these to both for it to work.

If I added any subdirectories, it did not work for some reason.

Thank you all for your responses.

'py' works but not 'python' in command prompt for windows 10

py is itself located in C:\Windows (which is always part of the PATH), which is why you find it. When you installed Python, you didn't check the box to add it to your PATH, which is why it isn't there. In general, it's best to use the Windows Python Launcher, py.exe anyway, so this is no big deal. Just use py for launching consistently, and stuff will just work. Similarly, if py.exe was associated with the .py extension at installation time, a standard shebang line (details in PEP linked above) will let you run the script without even typing py.

I don't know precisely what VSCode uses to find Python (using py.exe directly, using a copy of Python that ships with the editor, performing registry lookup, a config file that just says where to find it, etc.), but that's not really relevant to running your scripts yourself.

Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings

You need to download Python from https://python.org. When in the installation, be sure to check the option that adds Python to PATH.

Why doesn't the command Python not do anything in Command Prompt?

Update.

I simply uninstalled and reinstalled Python. Once I did that, the program works as it should in CMD.

enter image description here



Related Topics



Leave a reply



Submit