[Tutor] Making sense of "'python' is not recognized as an internalor external command...

Alan Gauld alan.gauld at btinternet.com
Sat Aug 29 00:40:09 CEST 2009


"Eduardo Vieira" <eduardo.susan at gmail.com> wrote 

> Hello, list. Sorry, for this basic question. But why in Windows (XP)
> command prompt I get this message if, for example I type "python
> myscript.py"? But it works if I simply type myscript.py? 

In the latter case Windows usees a registry setting to pick up what 
program to use. In the first case it looks for python in its PATH.
(Notice this is different to PYTHONPATH!)

Unfortunately the Windows installer no longer automatically adds 
Python to your PATH you have to do this yourself.

To check that this works you can do it from a command window by typing

SET PATH %PATH%;C:\Program Files\Python26

Or whatever the actual path to your python is.

After typing that you should find you can type Python from anywhere
on your PC and it will work. If that solves the problem you now need 
to add it to the envirtonment variables so that it is set every time.

This is done via MyComputer->Properties->Advanced->Environment Variables
Select Path and click Edit

Be very careful not to accidentally delete the existing path!
add your Python folder to the end of the existing path separating 
it with a semi-colon.

That should work!

HTH,

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/



More information about the Tutor mailing list