我正在尝试在iGraph
中绘制图形,但是一直出现与cairo
相关的错误。
import igraph as ig
import cairocffi as cairo
# [generate graph]
ig.plot(graph)
给出错误:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-37-e4df540328af> in <module>()
----> 1 ig.plot(comms,mark_groups=True)
~/.pyenv/versions/3.6.0/lib/python3.6/site-packages/igraph/drawing/__init__.py in plot(obj, target, bbox, *args, **kwds)
444 bbox = BoundingBox(bbox)
445
--> 446 result = Plot(target, bbox, background=kwds.get("background", "white"))
447
448 if "margin" in kwds:
~/.pyenv/versions/3.6.0/lib/python3.6/site-packages/igraph/drawing/__init__.py in __init__(self, target, bbox, palette, background)
115 """
116 self._filename = None
--> 117 self._surface_was_created = not isinstance(target, cairo.Surface)
118 self._need_tmpfile = False
119
AttributeError: module 'cairo' has no attribute 'Surface'
我已经尝试过:
更新pycairo并安装py2cairo(不成功)。
更新cairocffi。
请帮助!