Let´s suppose, we have installed Python in Windows using the default installation options, the path to the Python executable wasn’t added to the Windows Path variable

PS:  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, we will be able to access python.exe by typing the python keyword (We 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:

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

As we can see from the output above, the command was not found. To run python.exe, we 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:

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

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

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

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

C:>python --version
Python 3.4.3

By Shabazz

Software Engineer, MCSD, Web developer & Angular specialist

Leave a Reply

Your email address will not be published. Required fields are marked *