[Tutor] Starting python from a DOS prompt from any directory?

Steve Oldner Steven.Oldner at LA.GOV
Sun Dec 31 20:27:01 CET 2006

I am learning Python on the office computer which is networked, and am not allowed to change defaults (programmers aren't allowed to do system admin stuff, heck, we can't even move our PC's or monitors).  
I've got PYTHON installed in d:\python25.
So at the DOS prompt, g:\ type in d:\
Then at the d:\ type in CD python25, which changes it to d:\python25.  
>From there, it's just python mystuff.py to run my programs.


From: tutor-bounces at python.org on behalf of Alan Gauld
Sent: Sun 12/31/2006 2:42 AM
To: tutor at python.org
Subject: Re: [Tutor] Starting python from a DOS prompt from any directory?

"Daniel McQuay" <simplebob at gmail.com> wrote

> from a DOS prompt. i am used to running python from a linux box
> where you
> can just type "python" or "python24" from a shell prompt and the
> python
> shell executes from any directory.

> testing code. now i am using a windows xp media center edition
> laptop with
> python 2.5 installed and when i go to run and then type "cmd" and
> then type
> "python" from the directory where the run "cmd" command drops me it
> says
> 'python' is not a recognized as an internal or external command.

You need to set up your PATH environment variable to include the
python directory. You do this on XP(not so sure about Media Centre!)
via the MyComputer->Properties->Advanced->Environment Variables route
Once there you need to find the PATH variable and edit it to add the
folder where Python lives (look at the properties of the shortcut to
Python that you normally use to stat it).


Alan Gauld
Author of the Learn to Program web site

Tutor maillist  -  Tutor at python.org

More information about the Tutor mailing list