我正在尝试用python igraph创建一个情节:
from igraph import *
vertices = ["one", "two", "three"]
edges = [(0,2),(2,1),(0,1)]
g = Graph(vertex_attrs={"label": vertices}, edges=edges, directed=True)
plot(g)
我安装了所有这些:
sudo apt-get install libffi-dev
sudo pip install cffi
sudo pip install cairocffi
我仍然会收到此错误:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/chovanec/anaconda3/lib/python3.5/site-packages/igraph/drawing/__init__.py", line 446, in plot
result = Plot(target, bbox, background=kwds.get("background", "white"))
File "/home/chovanec/anaconda3/lib/python3.5/site-packages/igraph/drawing/__init__.py", line 117, in __init__
self._surface_was_created = not isinstance(target, cairo.Surface)
AttributeError: module 'cairo' has no attribute 'Surface'
我找不到导致它的原因。