Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > python from any command line?

Reply
Thread Tools

python from any command line?

 
 
waltbrad
Guest
Posts: n/a
 
      12-09-2007
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.
 
Reply With Quote
 
 
 
 
Adonis Vargas
Guest
Posts: n/a
 
      12-09-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
 
Reply With Quote
 
 
 
 
waltbrad
Guest
Posts: n/a
 
      12-09-2007
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.
 
Reply With Quote
 
john
Guest
Posts: n/a
 
      12-09-2007
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
 
Reply With Quote
 
Christian Heimes
Guest
Posts: n/a
 
      12-09-2007
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
 
Reply With Quote
 
Christian Heimes
Guest
Posts: n/a
 
      12-09-2007
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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
501 PIX "deny any any" "allow any any" Any Anybody? Networking Student Cisco 4 11-16-2006 10:40 PM
NCQ (Native Command Queuing) and TCQ (Tagged Command Queuing) Explained Silverstrand Front Page News 0 04-17-2006 05:49 PM
Run Unix shell command $ parse command line arguments in python rkoida@yahoo.com Python 4 04-23-2005 04:42 AM
RUN/execute a Command-Line command from an ASP page. Lucas Cowald ASP .Net 4 10-23-2003 11:09 AM
copying value of DDL in a Datagrid "pre-edit command" to value in "post edit command" San Diego Guy ASP .Net 0 08-07-2003 08:59 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57