Geek University

Add Python to the Windows Path

If you’ve installed Python in Windows using the default installation options, the path to the Python executable wasn’t added to the Windows Path variable. The Path variable lists the directories that will be searched for executables when you type a command in the command prompt. By adding the path to the Python executable, you will be able to access python.exe by typing the python keyword (you won’t need to specify the full path to the program).

Consider what happens if we enter the python command in the command prompt and the path to that executable is not added to the Path variable:

'python' is not recognized as an internal or external command,
operable program or batch file.

As you can see from the output above, the command was not found. To run python.exe, you need to specify the full path to the executable:

C:\>C:\Python34\python --version
Python 3.4.3

To add the path to the python.exe file to the Path variable, start the Run box and enter sysdm.cpl:

run dialog box

This should open up the System Properties window. Go to the Advanced tab and click the Environment Variables button:

environment variables

In the System variable window, find the Path variable and click Edit:

edit environment variables

Position your cursor at the end of the Variable value line and add the path to the python.exe file, preceeded with the semicolon character (;). In our example, we have added the following value: ;C:\Python34

add path

Close all windows. Now you can run python.exe without specifying the full path to the file:

C:>python --version
Python 3.4.3
If you get the ‘python’ is not recognized as an internal or external command, operable program or batch file. error, there is something wrong with your Path variable. Note also that you will have to reopen all command prompt windows in order for changes to the Path variable take effect.

Subscribe to our Newsletter

Like us on Facebook

Share on Twitter

Developed by Signum Soft