Adding Python to PATH on Windows
- Hold Win and press Pause.
- Click Advanced System Settings.
- Click Environment Variables.
- Append
;C:\python27
to thePath
variable. - Restart Command Prompt.
When setting Environmental Variables in Windows, I have gone wrong on many, many occasions. I thought I should share a few of my past mistakes here hoping that it might help someone. (These apply to all Environmental Variables, not just when setting Python Path)
Watch out for these possible mistakes:
- Kill and reopen your shell window: Once you make a change to the ENVIRONMENTAL Variables, you have to restart the window you are testing it on.
-
NO SPACES when setting the Variables. Make sure that you are adding the
;C:\Python27
WITHOUT any spaces. (It is common to tryC:\SomeOther; C:\Python27
That space (␣) after the semicolon is not okay.) - USE A BACKWARD SLASH when spelling out your full path. You will see forward slashes when you try
echo $PATH
but only backward slashes have worked for me. -
DO NOT ADD a final backslash. Only
C:\Python27
NOTC:\Python27\
Hope this helps someone.
Open cmd.exe with administrator privileges (right click on app). Then type:
setx path "%path%;C:\Python27;"
Remember to end with a semi-colon and don't include a trailing slash.
I've had a problem with this for a LONG time. I added it to my path in every way I could think of but here's what finally worked for me:
- Right click on "My computer"
- Click "Properties"
- Click "Advanced system settings" in the side panel
- Click "Environment Variables"
- Click the "New" below system variables
-
in name enter
pythonexe
(or anything you want) -
in value enter the path to your python (example:
C:\Python32\
) - Now edit the Path variable (in the system part) and add
%pythonexe%;
to the end of what's already there
IDK why this works but it did for me.
then try typing "python" into your command line and it should work!
Edit:
Lately I've been using this program which seems to work pretty well. There's also this one which looks pretty good too, although I've never tried it.