Department of Engineering

IT Services

Python on CUED's central system

In the Linux system's "Applications" menu, in the Programming submenu there are options to run a python3 environment (with Spyder, etc) and and option to start a terminal window with paths set up ready to use python 3.

Typing /usr/local/apps/anaconda3/bin/python in a terminal window on a CUED Linux machine will run the Python interpreter that Mich term first years use in the cloud. There are many other versions of Python installed, so beware. Typing python3 will give you a similar version, but the choice of packages is different.

You can install private versions of packages. First you need to create a folder for them. These instructions will assume that you have a folder called mypython in your home folder. Let's suppose that you want to install a python3 package called mysqlparse

  • From a terminal window run
    /usr/local/apps/anaconda3/bin/pip3 install --install-option="--prefix=$HOME/mypython" mysqlparse
  • Type
    export PYTHONPATH=${PYTHONPATH}:${HOME}/mypython/lib/python3.4/site-packages
    (the "3.4" may be different on your system) so that python will be able to find your packages. You'll need to do this at the start of each session (though you can make it happen automatically when you login).
  • If from the same terminal window you now run
    /usr/local/apps/anaconda3/bin/python
    you'll find that
    import mysqlparse
    works.