解决failed to execute [‘dot’, ‘-Tsvg’], make sure the Graphviz executables are on your systems

在用python可视化.dot文件时,遇到了ExecutableNotFound: failed to execute [‘dot’, ‘-Tsvg’], make sure the Graphviz executables are on your systems的报错。起初以为原因是未安装graphviz模块,pip一下发现还是不行,后来才发现需要先安装graphviz程序,才能为python安装相应模块。

安装步骤:

①安装graphviz

②配置环境变量

③安装到python

 

安装graphviz

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

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

解决failed to execute [‘dot’, ‘-Tsvg’], make sure the Graphviz executables are on your systems

配置环境变量

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

①先设置用户变量

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

解决failed to execute [‘dot’, ‘-Tsvg’], make sure the Graphviz executables are on your systems

解决failed to execute [‘dot’, ‘-Tsvg’], make sure the Graphviz executables are on your systems

②设置系统变量

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

解决failed to execute [‘dot’, ‘-Tsvg’], make sure the Graphviz executables are on your systems

解决failed to execute [‘dot’, ‘-Tsvg’], make sure the Graphviz executables are on your systems

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

解决failed to execute [‘dot’, ‘-Tsvg’], make sure the Graphviz executables are on your systems

安装到python

打开命令提示符,执行pip install graphviz即可