Windows – How to Add Python to PATH

pathpythonwindows

I want to be able to run Python commands from the Windows CMD. However, if I don't specify Python's full path for each command, I get an error saying "Python is not recognized as an internal or external command, operable program or batch file."

How do I add Python to the Windows PATH permanently?

Best Answer

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.

Related Question