我已尝试运行http://computationallegalstudies.com/2009/11/15/programming-dynamic-models-in-python-3-outbreak-on-a-network/处找到的代码,但最后会显示以下内容:
File "/Library/Python/2.7/site-packages/igraph/drawing/__init__.py", line 446, in plot
result = Plot(target, bbox, background=kwds.get("background", "white"))
File "/Library/Python/2.7/site-packages/igraph/drawing/__init__.py", line 117, in __init__
self._surface_was_created = not isinstance(target, cairo.Surface)
File "/Library/Python/2.7/site-packages/igraph/drawing/utils.py", line 396, in __getattr__
raise TypeError("plotting not available")
TypeError: plotting not available
它是在网络上建模SIR模型的代码。我真的需要别人的帮助,因为我无法使用计算机,在这种情况下是mac。提前谢谢
答案 0 :(得分:2)
您需要安装Cairo库及其Python绑定以进行绘图。如果你使用的是Homebrew,那只是brew install cairo py2cairo
的问题,假设您使用系统Python(从堆栈跟踪判断,你似乎是这样)。