How to install pycairo on osx?

后端 未结 6 1327
夕颜
夕颜 2020-12-09 20:07

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

I started with

easy_install pycairo

6条回答
  •  孤城傲影
    2020-12-09 20:42

    Ok. I solved it. Putting solution here for future reference, it might help someone.

    Basically, the whole ports/fink system is a bit messed up, and osx doesn't really play nice with the linux-y world.

    So, the steps I needed to install pycairo on OSX were:

    • download the latest source versions of pixman, cairo, pycairo
    • extract everything. Then:

      cd PIXMAN_DIR ; ./configure ; make ; sudo make install 
      cd CAIRO_DIR ; cp PIXMAN_DIR/pixman/*.h . ; ./configure ; make ; sudo make install
      cd PYCAYRO_DIR; locate cairo.pc 
      

      hopefully, several locations are returned. choose the most likely one (one with newest cairo). For me it was "/opt/local/lib/pkgconfig/cairo.pc" and do:

      export PKG_CONFIG_PATH=/opt/local/lib/pkgconfig/
      

      after this, still in PYCAIRO_DIR, do:

      python setup.py install
      

    This should do it...

提交回复
热议问题