Main Menu

Install and run...

Links

Installing and Running Python

Go to www.python.org. In the menu on the left, click "Download".
The computer labs in the School of IT building use Python 2.5 (specifically 2.5.1) so
we are going to download Python 2.5.4, the last bugfix release of Python 2.5. Click on
"Python 2.5.4". You should end up here.

Mac OS X (10.3 or later)

Install:

Python is probably already installed on your computer. To check, go to the "Utilities"
folder in the Applications folder and double-click "Terminal". Type python --version.
If you have it installed, it should print something like Python 2.5.1. If
you're happy to use the command-line interpreter and you have at least Python 2.5 installed,
you can skip this step; if you want to use the GUI instead, continue on.

Download python-2.5.4-macosx.dmg (18.4MB). Double-click this file from where it
downloaded — it should mount a drive on your desktop called "Universal MacPython 2.5.4".
Inside is a file called "MacPython.mpkg" — double-click it and follow the instructions to
install (default settings should be fine). You will need to enter an administrator password.
The default installation puts files in /usr/local/bin and
/Library/Frameworks/Python.framework.
It also puts an application called IDLE in "MacPython 2.5" in the Applications folder.

Run the interpreter:

To use the GUI interface, double-click on "IDLE" in "MacPython 2.5" in the Applications folder.
To run the Python interpreter from the command-line, double-click on "Terminal" in "Utilities"
in the Applications folder, and type python. To exit, press ctrl-D.

Run a Python program:

In IDLE, open the file and from the "Run" menu select "Run Module". Alternatively, press F5.
To run the program from the command-line, open Terminal as above, change to the directory where the
file is stored (e.g. cd Documents) and type python filename (e.g.
python test.py).

Windows

Install:

Download python-2.5.4.msi (10.8MB). If you happen to have Windows 64-bit, you'll
need one of the other two .msi files. This needs Microsoft Installer to run — if
your computer doesn't have that (most do), follow the links given to download it from Microsoft.
Double-click the .msi file. It may give you a warning about running the program — press
"Run". Choose whether you want to install the program for just you or for everyone on the computer
(you may need adminstrator privileges), then follow the instructions (default settings should
be fine). You should now have "Python 2.5" on your Start menu under "All Programs".

If you want to use Python from the command-line, you will need to change your Path.
In Windows 2000/XP, right-click "My Computer". Go to Properties > Advanced
> Environment Variables. Under "System variables" select the variable "Path" and click "Edit".
Add C:\Python25 to the end of the list, making sure there is a semi-colon separating
it from the previous entry. (C:\Python25 is the default installation directory;
if you installed Python somewhere else, type that location instead.)

Run the interpreter:

To use the GUI interface, go to Start > All Programs > Python 2.5 > IDLE (Python GUI).
To run Python from the command-line, you first need to change your Path as described above. Then
go to Start > All Programs > Accessories > Command prompt. Type python.
To exit, press ctrl-Z enter.

Run a Python program:

In IDLE, open the file and from the "Run" menu select "Run Module". Alternatively, press F5.
To run the program from the command-line, open the Command prompt as above, change to the
directory where the file is stored (e.g. cd "My Documents" — the quotes
are needed because of the space in the directory name) and type python filename
(e.g. python test.py).

Unix/Linux

Install:

You probably don't want to install from source, all Linux/Unix distributions
will have Python in the package manager. On Ubuntu/Debian or similar just type:

sudo apt-get install python

If you're sure you want to install from source, download
Python-2.5.4.tgz (11.1MB). Change to the directory where you
downloaded the file and execute the following commands:

tar -xzf Python-2.5.4.tgz

cd Python-2.5.4

./configure

make

make install

If you have difficulty with make install, try sudo make install
and enter an administrator password. If you don't have administrator rights,
you can run python from that directory.

Run the interpreter:

Type python. To exit, press ctrl-D.

Run a Python program:

Change to the directory where the program is stored and type python filename
(e.g. python test.py).