首先确保以下三个库已经安装好
pip install pydot;pip install pydot-ng;pip install graphviz
然后,GraphViz官网下载安装包或者压缩包https://graphviz.gitlab.io/_pages/Download/Download_windows.html,安装后,找到bin位置,将地址添加到Path环境变量中即可。
可能会遇到的报错OSError: `pydot` failed to call GraphViz.Please install GraphViz (https://www.graphviz.org/) and ensure that its executables are in the $PATH.
不要慌,确保上述依赖包都安装好的话,可能是环境没配置成功,重新更改一下环境变量中的地址试一下,配置成功后,在命令行输入dot -version,会有如下版本信息
实在不行的话,就简单粗暴一点,直接在代码中添加环境
import os
os.environ["PATH"] += os.pathsep + 'D:\PyCharm 2018.1.3\GraphViz\bin'
OK,搞定,第一次用,配合keras这些还挺麻烦