473,659 Members | 3,592 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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\exam ples>python

C:\PP3rdEd\Exam ples\PP3E\Syste m>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 1842
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\exam ples>python

C:\PP3rdEd\Exam ples\PP3E\Syste m>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...@REMOVE THISearthlink.n et>
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\exam ples>python
C:\PP3rdEd\Exam ples\PP3E\Syste m>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:\Python 25\" (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\py thon.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\py thon.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
2356
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 line -----> Python 2.3 (#46, Jul 29 2003, 18:54:32) on win32 Type "help", "copyright", "credits" or "license" for more information. >>> from Tkinter import * >>> root = Tk()
52
3749
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
1905
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. http://sourceforge.net/projects/movpy http://www.voidspace.org.uk/python/movpy Fancy trying out Python 2.4 without installing it ? Want a distribution of python you can carry around on a flash card ? Need to test scripts with several versions of python ? Movable Python may...
15
7377
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 history command in IDLE (in fact with IDLE in general). Often I'll develop new code at the command line, testing each line as I go. Currently I have to copy and paste, removing outputs and the ">>>" at each line. Is it perhaps possible to make...
75
4636
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 functions are simplified versions of the full featured methods for compiled regular expressions. Most non-trivial applications always use the compiled form UNQUOTE
1
2011
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 after unpacking the tar, i run "python setup.py install", as it says in the installation instructions. i get the following:
4
2907
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 that I am hoping to squash ... Namely, when I hit <esc> to go to edit mode, then hit 'k' to go up in the command history, the prompt is put at the start of the line. Other places I use vi mode command line editing (e.g., zsh), the
18
2935
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
1602
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 ActiveState python: ActivePython 2.4.3 Build 11 (ActiveState Software Inc.) based on Python 2.4.3 (#1, Apr 3 2006, 18:07:58) on sunos5 Type "help", "copyright", "credits" or "license" for more information.
0
3467
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 do not inherit this value. From "man bash": Shell Variables The following variables are set by the shell:
0
8428
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8851
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8531
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8628
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6181
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5650
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2754
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1978
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.