How do I add Python to the Windows PATH?
For Windows 10/8/7:
- Open
System Properties
(Right clickComputer
in the start menu, or use the keyboard shortcut Win+Pause) - Click
Advanced system settings
in the sidebar. - Click
Environment Variables...
- Select
PATH
in theSystem variables
section - Click
Edit
Add Python's path to the end of the list (the paths are separated by semicolons). For example:
C:\Windows;C:\Windows\System32;C:\Python27
For Windows XP:
- Open
System Properties
(Type it in the start menu, or use the keyboard shortcut Win+Pause) - Switch to the
Advanced
tab - Click
Environment Variables...
- Select
PATH
in theSystem variables
section - Click
Edit
Add Python's path to the end of the list (the paths are separated by semicolons). For example:
C:\Windows;C:\Windows\System32;C:\Python27
Test on a new terminal window or if using an integrated terminal within a text editor, close and restart your editor or the changes won't be applied.
For anyone trying to achieve this with Python 3.3+, the Windows installer now includes an option to add python.exe to the system search path. Read more in the docs.
- Click on the windows button to start a search
- type in "system env" and click on the "edit system environment variables"
- Now click on the advanced tab on the top
- At the bottom click the button that says "environment variables"
- Now on the "user variables'your user name'" box at the top of the windows click on path then edit
- This should lead to another window where you want to click "new" and type in the commands: "C:\Python27" and "C:\Python27\scripts"
- Python should now work on command prompt