How to install pycairo on osx?

后端 未结 6 1301
夕颜
夕颜 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:16

    On Mac OS you can have multiple Python versions installed. You can have even more if you decide to install Python via Fink or MacPorts. When you compile libraries from the source, you should make sure they point to the correct installation.

    I currently have Python 2.5.1 and Python 2.6.4 installed on my machine, which I can call via python2.5 and python respectively. They live in two different folders: /System/Library/Frameworks/Python.framework/Versions/2.5and /Library/Frameworks/Python.framework/Versions/2.6

    I was running into a similar problem when compiling pycairo 1.8.8 from the tarball. The INSTALL file in this case is your friend, as it contains the correct instructions to avoid potential version conflicts. You basically need to specify the correct prefix so that the package will be installed in the correct folder.

    $ python -c "import sys; print sys.prefix"
      # make a note of the python prefix
    $ ./configure --prefix=[python_prefix]
    $ make
    $ make install       # may require superuser access
    

    Running these instructions with python2.5 and python you will be able to correctly install pycairo for both versions (or for any version installed via MacPorts / Fink).

提交回复
热议问题