471,310 Members | 1,031 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,310 software developers and data experts.

python from any command line?

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.
Dec 9 '07 #1
5 1713
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
Dec 9 '07 #2
On Dec 9, 8:54 am, Adonis Vargas <adon...@REMOVETHISearthlink.net>
wrote:
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
Got it, Adonis. Thanks much.
Dec 9 '07 #3
Hi,

You need to edit your path variable. (I'm assuming you're using
Windows). Go to:

Settings Control Panel System Advanced Environment Variables.

Now double click on 'Path' and append ";C:\Python25\" (minus the
quotation marks) to the text displayed in the Variable Value box.

BW,

John
Dec 9 '07 #4
waltbrad wrote:
Is there a way to set this so I can also invoke it from any command
line prompt?
You can follow Adonis' advice but I'm going a different path on my
computer because I've multiple versions of Python installed on my box.

I usually put a simple batch file in c:\Windows, e.g. python25.bat

@C:\Python25\python.exe %*

I can start Python 2.5 with python25 from every directory.

Christian
Dec 9 '07 #5
waltbrad wrote:
Is there a way to set this so I can also invoke it from any command
line prompt?
You can follow Adonis' advice but I'm going a different path on my
computer because I've multiple versions of Python installed on my box.

I usually put a simple batch file in c:\Windows, e.g. python25.bat

@C:\Python25\python.exe %*

I can start Python 2.5 with python25 from every directory.

Christian

Dec 9 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Adam | last post: by
52 posts views Thread by Olivier Scalbert | last post: by
reply views Thread by Fuzzyman | last post: by
1 post views Thread by jtan325 | last post: by
4 posts views Thread by tnoell | last post: by
18 posts views Thread by stylecomputers | last post: by
reply views Thread by Martijn de Munnik | last post: by
reply views Thread by Cameron Simpson | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.