Adding python to windows path not working

15,276

Solution 1

What am I doing incorrectly here?

You are not saving your changes correctly.

Look at the bottom of the dialog where you are editing. There are OK and Cancel buttons. Press OK. Then OK on the next dialog, etc ... it should be a total of 3 times:

enter image description here

After you have done this open a new cmd prompt and your modified path should show when you type path.

Solution 2

Adding for future reference, as I struggled with this same problem for a while and none of the suggested solutions here or elsewhere fixed the issue for me.

If you have WindowsApps in your path variable then you want to make it is below your Python directory in the list. The reason is WindowsApps contains a python.exe, but it isn't actually python, just a hook to launch Windows Store and search for Python. If WindowsApps appears first in your path variable then Windows will try to use this when you run python from cmd, rather than the python.exe in the directory you have pointed to.

Solution 3

1) get rid of the trailing backslash (notice none of the other entries has one) 2) make sure you open a new command prompt after making changes.

Solution 4

Make sure to keep up your python above your windows apps.

Example

Share:
15,276

Related videos on Youtube

Alec Rhea
Author by

Alec Rhea

"Every triangle is a love triangle when you love triangles." -Pythagoras

Updated on September 18, 2022

Comments

  • Alec Rhea
    Alec Rhea over 1 year

    After following the instructions on the answer to this quetion, my computer still doesn't recognize python as an internal or external command, operable program or batch file.

    I've uploaded a picture for context; what am I doing incorrectly here?enter image description here

    EDIT: Here is another picture to show that I am inside path, but the issue seems to be that it won't save the changes I'm making. I copy the correct line in and press enter then press okay, but it's gone when I pull it back up.

    • DavidPostill
      DavidPostill almost 6 years
      Comments are not for extended discussion; this conversation has been moved to chat.
  • Alec Rhea
    Alec Rhea almost 6 years
    Thank you, but I deleted the trailing backslash on the top entry if that's what you meant and opened a new command prompt and it still doesn't recognize python as a command.
  • Bill Hileman
    Bill Hileman almost 6 years
    Navigate to the folder and confirm that the location exists. If the command to start python is "python" you could also locate it from your command prompt by typing dir python.exe /s
  • Alec Rhea
    Alec Rhea almost 6 years
    That yields the following: C:\Users\alecj>dir python.exe /s Volume in drive C is Windows Volume Serial Number is 5875-E6CD Directory of C:\Users\alecj\AppData\Local\Programs\Python\Python37-32 06/27/2018 04:08 AM 97,432 python.exe 1 File(s) 97,432 bytes Directory of C:\Users\alecj\PycharmProjects\test\venv\Scripts 07/01/2018 01:33 AM 97,432 python.exe 1 File(s) 97,432 bytes Total Files Listed: 2 File(s) 194,864 bytes 0 Dir(s) 91,200,049,152 bytes free
  • Alec Rhea
    Alec Rhea almost 6 years
    Is the answer buried in there somewhere? I'm not sure what you mean by 'navigate to the folder', but I copied the string I put in path directly from file explorer.
  • Bill Hileman
    Bill Hileman almost 6 years
    Yes, as @DavidPostill mentioned above, you need to specifically add C:\Users\alecj\AppData\Local\Programs\Python\Python37-32 to your path
  • Bill Hileman
    Bill Hileman almost 6 years
    I'm not sure what your original screen capture is of, but it doesn't appear to be your path.
  • Alec Rhea
    Alec Rhea almost 6 years
    I've uploaded another screenshot to show that it is my path, but the changes won't save for some reason.
  • Bill Hileman
    Bill Hileman almost 6 years
    Instead of editing the path in User variables change the one in System variables.
  • ex28
    ex28 over 2 years
    This resolved the issue I was having.
  • schlingel
    schlingel about 2 years
    Yes, this is important because there is another python executable under WindowsApps dir which opens the Windows Store and then does nothing. Thanks!