Install Cairo Graphics and PyCairo on Ubuntu 14.04 / Linux Mint 17

Share Tweet

Cairo is a 2D graphics library implemented as a library written in the C programming language but if you’d like to use Python programming language, you should also install Python bindings for Cairo.

Cairo Logo

This guide will go through installation of Cairo Graphics library version 1.14.2 (most recent) and py2cairo Python bindings version 1.10.1 (also most recent).

Install Cairo

It’s very easy with the following repository. Just add it, update your packages and install.

sudo add-apt-repository ppa:ricotz/testing
sudo apt-get update
sudo apt-get install libcairo2-dev

Install py2cairo

cd ~
git clone git://git.cairographics.org/git/py2cairo

See what’s your prefix

python -c "import sys; print sys.prefix"
/usr

Install dependencies

sudo apt-get install automake pkg-config libtool

Build

cd ~/py2cairo
./autogen.sh --prefix=/usr
./configure
sudo make
sudo make install

Verify

python
>>> import cairo
>>> cairo.cairo_version_string()
'1.14.2'
>>> cairo.version
'1.10.1'

Now, you can use up-to-date versions of these softwares in your computer.

Share Tweet

Questions?

Please start a discussion down below or send me an email!