Last Updated: Saturday 21st December 2013

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

Install 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.

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!

  • Pingback: How to execute a Python program through a file or the shell | Python Central

  • Daniel Robles P

    Note: add C:Python27Scripts to the path, it is usefull for install packages using easy_install or pip

  • Jeff

    Very informative. Thanks for posting…

  • http://www.planetarywebdesign.com Ali

    Thanks a bunch this was very helpful.

  • Mithun

    Thanks a lot. It really works.

  • engy

    this post is really helpful,if u can help what are steps to setup easy install and pip

  • sara

    thanks a lot

  • anonymous

    yeah not working for me http://puu.sh/2nByH

    • Jackson Cooper

      Hi There

      1) Make sure Python is installed in C:Python27. It might be C:Python33 if you have Python 3.x installed.

      2) Remove the space to the left. “;C:Python27″ not “; C:Python27″.

  • Xyres

    Thanks. I was really stuck at this.

  • Dinesh

    Crystal clear explanation. Thanks a lot!!!!

  • cory

    still not working i have win8 i dont know if that makes a difference or not. when i double click the .exe file python runs but i can not get to it from cmd

    • http://jacksonc.com Jackson Cooper

      The directory of where the Python executable is must be in %PATH%. In Win 8 does it use a similar interface?

    • Rafaela

      when you are looking for the path (up top his example is “;C:Python27″) make sure to use the path you installed on.

      file explorer>c:>python(version # goes here) mine was C:Python34 not 27

  • Rafaela

    This helped me out … i was youtube(ing) all over the place because nothing seemed to work for Wind 8 and this was the best explanation yet.

  • Darshith Badiyani

    Worked for me :) Thanks..

  • Prashant

    thanks for help