OSError: pydot failed to call GraphViz.Please install GraphViz

问题:OSError: pydot failed to call GraphViz.Please install GraphViz (https://www.graphviz.org/) and ensure that its executables are in the $PATH.
下载graphviz-2.38.msi,安装完以后相应的d:/Graphviz2.38/bin目录地下就有可执行文件了。 
将d:/Graphviz2.38/bin目录加到系统环境变量中就OK啦 

做完了上述步骤,结果还是不行。可能需要在程序里加

import os
os.environ["PATH"] += os.pathsep + 'C:/Program Files (x86)/Graphviz2.38/bin'

还是不行的话,通常是因为在win下失败,错误提示是找不到“dot”程序,而不是"dot.exe"程序,这就好办了,找到pydot的源码,在pydot.py中找到类Dot
 

OSError: pydot failed to call GraphViz.Please install GraphViz

 

修改self.prog = 'dot'为self.prog = 'dot.exe',之后测试,成功运行例子