python from any command line?

Adonis Vargas adonisv at REMOVETHISearthlink.net
Sun Dec 9 08:54:00 EST 2007


waltbrad wrote:
> Hi folks. I'm learning Python from the Mark Lutz Book, Programming
> Python 3rd edition.
> 
> He seems to be able to invoke the Python interpreter from any command
> line prompt.
> 
> C:\temp>python
> 
> C:\PP3rdEd\examples>python
> 
> C:\PP3rdEd\Examples\PP3E\System>cd
> 
> Whereas I am only able to invoke it when the command line is pointing
> to the directory where the executable resides. Currently:
> 
> C:\Python25
> 
> Is there a way to set this so I can also invoke it from any command
> line prompt?
> 
> Thankyou very much.

The Python executable must be found in your system path, that is why you 
are unable to just simply type python at anytime at a command prompt. 
Simple fix:

click Start > Control Panel > System > Advanced > Environment Variables 
(bottom right)

Then you will have two list boxes one for user environment variables 
another for system variables. I prefer placing the path in the System 
environment variables section that way it is available for all accounts 
on the system (provided you have more than 1 user on it).

In the System list locate the Path variables, select edit variable and 
append ;C:\Python25 to it. And thats it reopen a new command prompt the 
type python and it should just fire up.

Hope this helps.

Adonis Vargas



More information about the Python-list mailing list