If you're having trouble running python from Command Prompt in Windows, you may be seeing something like this:
I typed "python" but Windows can't find the program. How can we fix this?
Well you can always find the path to your Python executable, which if you installed Python 2.7 should be (by default) "C:\Python27\"; if this is your path, you can always type
into the console in place of just
If your path is something different from "C:\Python27\" you'll need to find to find out what it is. (You can always search for python.exe using your Windows search).
However if you're brave and you know what your Python path is, you can try this in the next section.
The Advanced Stuff
First, you have to find out where your python program is installed. Go to My Computer, and click on your C drive. If you installed Python 2.7 and just let it install where it wanted to, the path to python.exe should be something like "C:\Python27\python.exe"; this is important, because we're going to add the path (in this case "C:\Python27\") to the environment variables.
Environment variables are variables in Windows that help Windows keep track of certain things, like where to look for programs.
WARNING: This is advanced stuff and could possibly mess up stuff in your computer. If you do something wrong, bad things could happen. (All that to say, there are no guarantees. If you need further help, there are certainly other places on the internet that can help you do this, not the least of which is on the Python site itself.)
But don't panic; we'll try to back everything up.
Go to your "Computer" or "My Computer" icon (either on your desktop or in your start menu), right-click on it, and choose properties. In Windows Vista/7, you'll probably get a window that looks like this:
Go the right and click on "Advanced system settings." This should take you to something that looks like this:
In Windows XP, you should probably have come to this dialog box after you clicked "properties."
Now, go to the Advanced tab (if you're not there already).
Now click on the "Environment Variables" button. You should come to a dialog box like this:
Now for the tricky part. See where it says "User variables for [yourname]"? Check to see if there's one called Path, if so double-click it. If not, click the "New..." button right underneath. (Not the one below "System variables")
If you're creating a new variable, type the name "Path" into the "Variable Name:" field. Then below that, type "C:\Python27\" (or whatever your python path is) into the "Variable Value:" field.
If you're editing the Path variable, you'll want to go to the end of the current Variable Value (click in the box and hit the "End" key.) Now type a semicolon (;), and then "C:\Python27" (or whatever your python path is).
Whether you created it new or edited it, click "OK" on this box, and then click "OK" on the "Environment Variable" box. You should now be all set.
Open a Command Prompt window, and type "python"; the Python command line interpreter should start.
That's all there is to it!