python executable path to your Window’s PATH variable.

  1. From the desktop, right-click My Computer and click Properties.
  2. In the System Properties window, click on the Advanced tab.
  3. In the Advanced section, click the Environment Variables button.
  4. Highlight the Path variable in the Systems Variable section and click the Edit button.
  5. Add the path of your python executable(c:\Python27\). Each different directory is separated with a semicolon. (Note: do not put spaces between elements in the PATH. Your addition to the PATH should read ;c:\Python27 NOT ; C\Python27)
  6. Apply the changes. You might need to restart your system, though simply restarting cmd.exe should be sufficient.
  7. Launch cmd and try again. It should work.

Start Menu and right click My Computer. Click on Advanced System Settings.

My Computer Screenshot

Advanced System Settings

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

Add Python to The PATH Environment 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!

Changing Environment Variables

Edit Environment Variables

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 Windows Screenshot

Python running on Windows!

Window’s PATH variable

Post navigation

Leave a Reply

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

Pin It on Pinterest