如何在OSX上安装pycairo? [英] How to install pycairo on osx?

查看:109
本文介绍了如何在OSX上安装pycairo?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试安装 pycairo (我从

easy_install pycairo

得到了:

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

因此,我去了cairo的网站并下载了cairo的最新软件包(1.8.8),还下载了名为pixman的最新软件包(两个源软件包-找不到osx二进制文件)

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)

将两者解压缩,每个都在自己的目录中. 对于pixman,常规的./configure ; make ; sudo make install可以找到 对于开罗,./configure似乎可以工作,但是make失败:

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

我在做什么错了?

为什么要使软件库在可以正常工作"的操作系统上工作,我为什么要为此付出很多努力呢?为什么达尔文不更像Linux?

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?

推荐答案

我发现指令非常有帮助,而且混乱程度小得多.我在优胜美地上,对我来说效果很好.该说明使用自制软件进行安装.因此,如果您已经有了自制软件,那么以下两个命令应该会有所帮助:

I found this instruction very helpful and much less confusing. I am on Yosemite and it worked very well for me. This instruction uses homebrew to install. So if you already have homebrew, these two commands should be helpful:

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

对于非Homebrew安装的Python,此说明建议设置PYTHONPATH以查找pycairo.您可以将.bashrc/.profile/.whatever中的PYTHONPATH设置为以下内容:

For a non-Homebrew installed Python, this instruction suggest to 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 of the instruction but it might help you.

这篇关于如何在OSX上安装pycairo?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆