本文介绍了安装Cairo和PyCairo Mac OsX的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用python iGraph进行网络可视化.当我尝试绘制图形时,我得到了他的错误消息:

I am playing around with using python iGraph for network visualization. I got his error message when I tried to plot a graph:

>>> layout = g.layout("kk")
>>> plot(g, layout = layout)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "build/bdist.macosx-10.5-x86_64/egg/igraph/drawing/__init__.py", line 446, in plot
  File "build/bdist.macosx-10.5-x86_64/egg/igraph/drawing/__init__.py", line 117, in __init__
  File "build/bdist.macosx-10.5-x86_64/egg/igraph/drawing/utils.py", line 396, in __getattr__
TypeError: plotting not available

我认为我没有正确安装Cairo或PyCairo.

I don't think I installed Cairo or PyCairo correctly.

由于我通常使用Homebrew,因此我对使用Fink或MacPorts不熟悉.

I am not familiar using Fink or MacPorts, since I commonly use Homebrew.

任何帮助您都会感激不尽.

Any help you be greatly appreciated.

推荐答案

您需要手动编译该库.我在此处使用了解决方案,并只是更新了版本.>

You need to manually compile the library. I used the solution here and just updated the version.

curl -L https://www.cairographics.org/releases/cairo-1.14.6.tar.xz -o cairo.tar.xz
tar -xf cairo.tar.xz && cd cairo-1.14.6
./configure --prefix=/usr/local --disable-dependency-tracking
make install

如果在运行configure时收到有关pkg_config的错误,则可以使用brew安装它:

If while running configure, you get an error about pkg_config, you can install that with brew:

brew install pkg-config

这篇关于安装Cairo和PyCairo Mac OsX的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-03 09:15