我在win7(64)上遇到pygraphviz问题。我安装了Graphviz,然后是pygraphviz。当我尝试编译我的代码时
G=pgv.AGraph()
d={'1': {'2': None}, '2': {'1': None, '3': None}, '3': {'2': None}}
A=pgv.AGraph(d)
G.add_node(1, color='red')
G.add_edge('b','c',color='blue')
G.layout(prog='dot')
G.draw('file.png')
我收到此错误
pydev debugger: starting
Traceback (most recent call last):
File "D:\Program Files\Eclipse\plugins\org.python.pydev_3.3.3.201401272249\pysrc\pydevd.py", line 1738, in <module>
debugger.run(setup['file'], None, None)
File "D:\Program Files\Eclipse\plugins\org.python.pydev_3.3.3.201401272249\pysrc\pydevd.py", line 1355, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "D:\Users\SUUSER\workspace\ThreadGraph\parseText.py", line 17, in <module>
G.layout(prog='dot')
File "C:\Python27\lib\site-packages\pygraphviz\agraph.py", line 1305, in layout
data=self._run_prog(prog,' '.join([args,"-T",fmt]))
File "C:\Python27\lib\site-packages\pygraphviz\agraph.py", line 1251, in _run_prog
runprog=r'"%s"'%self._get_prog(prog)
File "C:\Python27\lib\site-packages\pygraphviz\agraph.py", line 1239, in _get_prog
raise ValueError("Program %s not found in path."%prog)
ValueError: Program dot not found in path.
别告诉我这是重复的。我看了所有的答案。
pygraphviz ValueError: Program dot not found in path
答案 0 :(得分:1)
如果PyGraphviz bin目录尚未添加到路径中,即使安装了PyGraphviz,也可能会出现此问题。我在Windows上遇到了这个问题(用.msi安装PyGraphviz之后)。
要解决此问题,请将bin目录(例如C:\ Program Files(x86)\ Graphviz2.38 \ bin)添加到PATH系统变量,例如:在Win7上:
系统属性 - &gt;环境变量 - &gt;系统变量 - &gt;路径 - &gt;编辑...
答案 1 :(得分:1)
如果您安装了Anaconda,最简单的方法是从CMD运行以下内容:
conda install graphviz
您可能还需要以下内容:
conda install pydot-ng