I have an anaconda distribution of python, so I tried
conda install cairo
conda install pycairo
But the latter throws error cannot find pixman even after I conda install pixman succesfully. So I gave up on this route and
brew install cairo
brew install py2cairo
This way cairo is installed in the brew directory. To use it with anaconda python, add it to the sys path
Then it works!
p.s. to manually compile pycairo, remember to add cairo to the path because I had hard time to have configure find cairo. This is not necessary if you use brew.
pkg-config –cflags-only-I cairo