Department of Engineering

IT Services

Python

Python is an interpreted, interactive, object-oriented programming language. It is often compared to Tcl, Perl, Scheme or Java. It's sometimes used within the university as a "glue" language to integrate various number-crunching processes.

From October 2016 it's the language taught to our first years. The coursework material is (or will be) online.

Python at CUED

In summer 2023, the python set-up on the linux (Rocky9) system was changed. Typing

  python

now runs the newest Python. As before, you can't install a package on the local system because you're not the administrator, but you can install packages for your own use. To install a package (e.g. chess) do

  python -m venv ~/venv
  source ~/venv/bin/activate
  pip install chess

Then you can start python and "import chess" will work.

The first command creates a folder called venv in your home folder, where the downloaded packages etc are installed. You won't need to re-run that command on subsequent logins, but it won't do any harm. You will need to re-run the "source ~/venv/bin/activate" command to use the previously downloaded packages.

On the linux (Rocky9) system run

  jupyter

to start a set-up where to can load in Jupyter notebooks. If you have a notebook called foo.ipynb you can run it using

  jupyter notebook foo.ipynb

The Windows system has the Anaconda suite of python-related programs (including vscode). Look in the "All apps" list. There you'll also find a "Jupyter Notebook" option that lets you work with notebooks.

Supplementary documentation

We've installed

Further Information

See the Python homepage