Add Python to the PATH Environmental Variable

Many developers install Python on their Windows machine, and when they try to run the console command python.exe, they get the following error message:
‘python’ is not recognized as an internal or external command

We’ll show you how to install Python, and fix this error. By adding Python to the PATH environmental variable.

Step 1: Download Python

First visit the official Python download page and download the latest release. At the time of this writing the latest versions are 2.7.3 and 3.3.0.
python-download-list-1024x654Install it by double clicking the Python installer setup file and follow the wizard along.

Step 2: Add Python to the PATH Environmental Variable

Next, let’s click on the Start Menu and right click My Computer. Click on Advanced System Settings.


Then click on Environment Variables. This is where we can add Python to the PATH environmental variable.


Find the PATH variable and click Edit. You want to add Python to this PATH variable by adding ;C:\Python27 to the end of that string (or whatever the path to your Python installation is).

Save your changes!


So what exactly is happening here?

When you type in python in a command prompt, Windows will use the PATH environmental variable to get a list of directories to go looking for the python.exe file. Before you followed the steps here, it couldn’t find the python.exe file, hence the error.

Now that the PATH variable is set, when you execute python via the Windows console, you’ll see a familiar programming prompt.


Python running on Windows!

Leave a Reply

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