Home page Models Systems Tools IT staff References
Installing Python Using Python
Python is a very widely used scripting language, especially on Unix systems. Versions are also available for Windows. We use Python for a few of our scripts for running models and post-processing the output. This is the Python official web site.
Python generally comes installed on Linux by default, but on Ubuntu it is typically version 2.6, which is too old a version for some of our scripts. Install version 2.7.x (the latest revision of 2.7; 3.x is too new and no longer supports some of the features used in our scripts), as follows (using the correct version number where needed):
Note on Ubuntu that you should not make any version of python you install the default version (the version that is run
by typing python
at the command prompt. This will interfere with system updates and with the printer
configuration tool. The printer configuration tool will not run - it is a python program and you will get an error
regarding an import of module gobject if the default python version was not the one installed with Ubuntu.
tar -xvf Python-2.7.2.tar.bz2
Python generally comes installed on Macs by default, but usually a version one or two years old. It is best to install the latest Python version, to be compatible with the Python scripts we use. Go to the Python release page, download the latest Python 2.7.x release for the Mac and run the installer.
Python doesn't come installed on Windows by default. This isn't a problem as we don't generally use Python scripts on Windows, since we don't generally do production runs or post-processing of run results on Windows. However, Python is available on Windows. Go to the Python release page, download the latest release for Windows and run the installer.
The Python web site has a documentation section which includes a turtorial. A wealth of information on Python can be found by using a Google search. It is often helpful to enter Python error messages into Google. There are also many books on Python. Python has an interactive mode that is very useful for experimenting with Python language features. Once installed on a system, simply type "python" at a command prompt (assuming the python executable is in your execution path). The Python interactive prompt is usually ">>>". You can type any Python statement or expression at the prompt. Statements entered are executed. A line that contains only an expression causes the expression to be executed and its result displayed on the screen.