graphviz.backend.ExecutableNotFound: failed to execute ‘dot‘, make sure the Graphviz executables are

Python 使用 Graphviz 绘图遇到的问题和解决方法

目录

    • 解决方法
      • 1.下载安装
      • 2.设置环境变量
      • 3.检查

在利用graphviz进行模型可视化时,调试出现如下报错:

graphviz.backend.ExecutableNotFound: failed to execute 'dot', make sure the Graphviz executables are on your systems' PATH

解决方法

1.下载安装

Graphviz的官网下载:https://graphviz.gitlab.io/_pages/Download/Download_windows.html,下载后按照提示进行安装就可以了;
graphviz.backend.ExecutableNotFound: failed to execute ‘dot‘, make sure the Graphviz executables are_第1张图片
在这里,我选了上述进行下载,然后选个地址进行安装

2.设置环境变量

如果没配置环境变量会出现如下报错:

'dot' 不是内部或外部命令,也不是可运行的程序 或批处理文件。

在:我的电脑-属性-高级系统设置-高级-环境变量-系统变量-找到Path 进行环境配置
graphviz.backend.ExecutableNotFound: failed to execute ‘dot‘, make sure the Graphviz executables are_第2张图片
graphviz.backend.ExecutableNotFound: failed to execute ‘dot‘, make sure the Graphviz executables are_第3张图片
graphviz.backend.ExecutableNotFound: failed to execute ‘dot‘, make sure the Graphviz executables are_第4张图片
新建一个包含dot.exe的路径,一般就是安装地址\bin
我的这里是D:\app\Graphviz\bin

3.检查

step1. win+R
step2. 输入cmd
graphviz.backend.ExecutableNotFound: failed to execute ‘dot‘, make sure the Graphviz executables are_第5张图片
step3. 输入dot -verison
graphviz.backend.ExecutableNotFound: failed to execute ‘dot‘, make sure the Graphviz executables are_第6张图片
观察到如上信息,则该设置生效

你可能感兴趣的:(报错解决方案,python)