How do I add Python to the Windows PATH?

For Windows 10/8/7:

  1. Open System Properties (Right click Computer in the start menu, or use the keyboard shortcut Win+Pause)
  2. Click Advanced system settings in the sidebar.
  3. Click Environment Variables...
  4. Select PATH in the System variables section
  5. Click Edit
  6. 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:

  1. Open System Properties (Type it in the start menu, or use the keyboard shortcut Win+Pause)
  2. Switch to the Advanced tab
  3. Click Environment Variables...
  4. Select PATH in the System variables section
  5. Click Edit
  6. 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
    
  7. 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