且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在OSX上安装pycairo?

更新时间:2023-01-20 10:42:10

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

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.