473,218 Members | 1,884 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,218 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 1825
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Adam | last post by:
Hi I had Ruby 1.6.8-8 for Windows installed on my WinXP Pro machine prior to installing Python 2.3. After installing Python 2.3, I tried to <----- screen output of python interactive command...
52
by: Olivier Scalbert | last post by:
Hello , What is the python way of doing this : perl -pi -e 's/string1/string2/' file ? Thanks Olivier
0
by: Fuzzyman | last post by:
Movable Python has just been released on sourceforge. Movable Python is a frozen distribution of Python. It will run python scripts without needing to be installed. ...
15
by: Ashot | last post by:
This is sort of both Python and Vim related (which is why I've posted to both newsgroups). Python related: ---------------------- I have been frustrated for quite some time with a lack of a...
75
by: Xah Lee | last post by:
http://python.org/doc/2.4.1/lib/module-re.html http://python.org/doc/2.4.1/lib/node114.html --------- QUOTE The module defines several functions, constants, and an exception. Some of the...
1
by: jtan325 | last post by:
hi, i am running Linux Ubuntu Hoary and am trying to build the Python numarray package, v. 1.3.2 by hand since ubuntu's repos won't be updated until breezy. i have python 2.4, and gcc 3.3.5 ...
4
by: tnoell | last post by:
Hi comp.lang.python: New to the group and new to python, so don't tear me up too much ... I installed the GNU readline support in python2.4, and it is working, but there is one annoying behaviour...
18
by: stylecomputers | last post by:
Hi All, What do you find the best IDE for creating web applications in Python is? Preferably FOS IDE. Cheers
0
by: Martijn de Munnik | last post by:
Hi, I'm trying to build/install pysqlite on a Solaris 10 platform. I've got Sun Studio 11 on a AMD 64 platform and got this error. I'm a python newbie and just want to install trac. I've got...
0
by: Cameron Simpson | last post by:
On 17Aug2008 21:25, John Nagle <nagle@animats.comwrote: Because $HOSTNAME is a bash specific variable, set by bash but NOT EXPORTED! Like $0 and a bunch of other "private" variables, subprocesses...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...

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.