NameError: name 'graph_draw' is not defined

NameError: name 'graph_draw' is not defined

在 arch-linux 上安装 AUR 包后,执行简单代码时出错。

makepkg -sri PKGBUILD (to install package)

因为有一个奇怪的错误,试图从源代码编译,所以决定使用 AUR.

/usr/lib/python3.5/site-packages/graph_tool/draw/cairo_draw.py:38: RuntimeWarning: Error importing cairo. Graph drawing will not work.
  warnings.warn(msg, RuntimeWarning)
/usr/lib/python3.5/site-packages/graph_tool/draw/cairo_draw.py:38: RuntimeWarning: Error importing cairo. Graph drawing will not work.
  warnings.warn(msg, RuntimeWarning)
/usr/lib/python3.5/site-packages/graph_tool/draw/cairo_draw.py:38: RuntimeWarning: Error importing cairo. Graph drawing will not work.
  warnings.warn(msg, RuntimeWarning)
/usr/lib/python3.5/site-packages/graph_tool/all.py:40: RuntimeWarning: Error importing draw module, proceeding nevertheless: No module named 'cairo'
  warnings.warn(msg, RuntimeWarning)
Traceback (most recent call last):
  File "lab_1.py", line 5, in <module>
    graph_draw(g, vertex_text=g.vertex_index)
NameError: name 'graph_draw' is not defined

shell returned 1

这是我在手动安装所有推荐后尝试 make 时发生的情况。

Makefile:521: recipe for target 'graph_hits.lo' failed
make[4]: *** [graph_hits.lo] Error 1
make[4]: Leaving directory '/home/kaldown/projects/risk_analysis/graph-tool-2.12/src/graph/centrality'
Makefile:731: recipe for target 'all-recursive' failed
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory '/home/kaldown/projects/risk_analysis/graph-tool-2.12/src/graph'
Makefile:407: recipe for target 'all-recursive' failed
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory '/home/kaldown/projects/risk_analysis/graph-tool-2.12/src'
Makefile:557: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/kaldown/projects/risk_analysis/graph-tool-2.12'
Makefile:465: recipe for target 'all' failed
make: *** [all] Error 2

https://graph-tool.skewed.de/download

如何在 arch-linux 上解决这个问题?

根据回溯中的 No module named 'cairo' 错误,我认为您需要安装 cairo