我有以下问题:我在 xUbuntu OS 上,我正在尝试在 Flask 应用程序中使用 networkx,并且我有以下代码:
.....
import networkx as nx
......
# Creating and initializing graph object which is networkx object
hosts_graph = get_networkx_graph_object()
# Variable 'coord' where the coordinates for each node will be stored
coord = nx.pygraphviz_layout(hosts_graph, prog = 'dot')
最后一行是第 411 行。我收到以下错误:
File "/home/kiril/Documents/workfolder/omeganoc-sprint/onoc/omeganoc/grapher.py", line 411, in grouping_method
coord = nx.pygraphviz_layout(hosts_graph, prog = 'dot')
File "/usr/local/lib/python2.7/dist-packages/networkx-1.7-py2.7.egg/networkx/drawing/nx_agraph.py", line 264, in pygraphviz_layout
A.layout(prog=prog,args=args)
File "/usr/local/lib/python2.7/dist-packages/pygraphviz-1.1-py2.7-linux-x86_64.egg/pygraphviz/agraph.py", line 1301, in layout
data=self._run_prog(prog,' '.join([args,"-T",fmt]))
File "/usr/local/lib/python2.7/dist-packages/pygraphviz-1.1-py2.7-linux-x86_64.egg/pygraphviz/agraph.py", line 1248, in _run_prog
runprog=self._get_prog(prog)
File "/usr/local/lib/python2.7/dist-packages/pygraphviz-1.1-py2.7-linux-x86_64.egg/pygraphviz/agraph.py", line 1236, in _get_prog
raise ValueError("Program %s not found in path."%prog)
ValueError: Program dot not found in path.
什么可能导致这个问题?我已经安装了 networkx 和 pygraphviz,但我仍然得到这个错误。任何想法如何解决这个问题?