ExecutableNotFound: failed to execute ['dot', '-Tsvg'], make sure the Graphviz executables are on yo

在用python可视化.dot文件时,graphviz生成树模型时出错 显示

ExecutableNotFound: failed to execute ['dot', '-Tsvg'], make sure the Graphviz executables are on yo

ExecutableNotFound: failed to execute ['dot', '-Tsvg'], make sure the Graphviz executables are on yo

安装步骤:

①安装graphviz

②配置环境变量

③安装到python

 

安装graphviz
官网下载地址:graphviz官网下载

选择.msi文件进行下载,下载完成后,运行.msi文件安装graphviz。记住自己的安装路径,配置环境变量时要用到。

ExecutableNotFound: failed to execute ['dot', '-Tsvg'], make sure the Graphviz executables are on yo

配置环境变量
环境变量的配置在此电脑→属性→高级系统设置→高级→环境变量

①先设置用户变量

双击进入用户变量的Path,然后新建,路径填写的是你安装graphviz的路径再加上\bin

ExecutableNotFound: failed to execute ['dot', '-Tsvg'], make sure the Graphviz executables are on yo

ExecutableNotFound: failed to execute ['dot', '-Tsvg'], make sure the Graphviz executables are on yo

②设置系统变量

双击进入系统变量的Path,然后新建,路径是graphviz的安装路径再加上\bin\dot.exe

ExecutableNotFound: failed to execute ['dot', '-Tsvg'], make sure the Graphviz executables are on yo

设置好后,打开命令提示符,执行dot -version可查看是否配置成功,若出现以下信息说明配置成功:

ExecutableNotFound: failed to execute ['dot', '-Tsvg'], make sure the Graphviz executables are on yo

安装到python
打开命令提示符,执行pip install graphviz即可