问题
I wanted to perform a simple plot with igraph but i get the following error:
File "testigraph.py", line 51, in <module>
plot(g, **visual_style)
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")
It looks like this error python + igraph "plotting not available" but I still cannot fix my problem. I tried following Cairo install instructions on http://igraph.org/python/doc/tutorial/install.html#installing-igraph but i dont see how to get it working.
--- EDIT
Now I get this error:
OSError: dlopen() failed to load a library: cairo / cairo-2
I found this solution Trouble running WeasyPrint after installing El Capitan (OSX 10.11) but it does not apply to OS X Yosemite. Running
csrutil status
Returns command not found.
Thanks!
回答1:
Same problem here ! I tried to install pycairo, py2cairo. The installation seemed to be okay but then:
- I could not import pycairo
- igraph's plot would not work
The following solved the igraph plotting issue:
sudo pip install cairocffi
So instead of pycairo I used cairocffi.
来源:https://stackoverflow.com/questions/34251426/python-igraph-unable-to-plot