I\'ve tried to install pycairo in a virtualenv to use in a Django project. I\'ve ran the pip install pycairo==1.10.0 command which finds the packag
For anyone trying to use pycairo (for Python 2.7) in conjunction with Homebrew and virtualenv --no-site-packages ... this Worked For Me:
brew install py2cairo
Then, find the path where Homebrew installed it to, will be something like:
ls -l /usr/local/lib/python2.7/site-packages/cairo/
total 24
lrwxr-xr-x 1 anentropic admin 80 10 Jun 14:26 __init__.py -> ../../../../Cellar/py2cairo/1.10.0/lib/python2.7/site-packages/cairo/__init__.py
lrwxr-xr-x 1 anentropic admin 78 10 Jun 14:26 _cairo.so -> ../../../../Cellar/py2cairo/1.10.0/lib/python2.7/site-packages/cairo/_cairo.so
You want to find the path at the base of those symlinks, something like:
/usr/local/Cellar/py2cairo/1.10.0/lib/python2.7/site-packages
Then create a .pth file in your virtualenv site packages:
echo "/usr/local/Cellar/py2cairo/1.10.0/lib/python2.7/site-packages" > venv/lib/python2.7/site-packages/cairo.pth
(may want to deactivate and re-activate your virtualenv for good luck, not sure)