Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install pycairo on osx?

I am trying to install the pycairo (Python bindings for the cairo graphics library) under OSX.

I started with

easy_install pycairo

and got:

Requested 'cairo >= 1.8.8' but version of cairo is 1.0.4

error: Setup script exited with Error: cairo >= 1.8.8 not found

So I went to cairo's site and downloaded the latest package (1.8.8) of cairo, and also the latest package of something called pixman (both source packages -- couldn't find osx binaries)

unzipped both, each in own directory. for pixman, the regular ./configure ; make ; sudo make install worked just find for cairo, ./configure seemed to work, but make failed with:

In file included from cairo-analysis-surface.c:37:
cairoint.h:71:20: error: pixman.h: No such file or directory

What am I doing wrong?

And why do I have to struggle so much to get a software library to work on an os that "just works"? Why isn't darwin more like linux?

like image 715
Yoav Avatar asked Sep 30 '09 21:09

Yoav


2 Answers

If you already have homebrew, these two commands should be helpful:

$ brew install cairo --use-clang 
$ brew install py2cairo

For a non-Homebrew installed Python, set the PYTHONPATH to find pycairo. You can set your PYTHONPATH in your .bashrc/.profile/.whatever to the following:

PYTHONPATH=/usr/local/lib/python2.7/site-packages:$PYTHONPATH.

I personally didn't need to use this last part but it might help you.

like image 189
Mina Avatar answered Nov 03 '22 01:11

Mina


Step 1: Run this from terminal ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null

Step 2: brew install cairo

Step 3: pip install pycairo

like image 45
seralouk Avatar answered Nov 02 '22 23:11

seralouk