首页 > 代码库 > InvocationException: GraphViz's executables not found

InvocationException: GraphViz's executables not found

当我在visualize决策树,运行以下代码时,报错: InvocationException: GraphViz‘s executables not found

import pydotplusfrom io import StringIOdot_data = http://www.mamicode.com/StringIO()>

查阅资料后发现,原来我没有安装GraphViz‘s executables.我是用pip安装的Graphviz,但是Graphviz不是一个python tool,你仍然需要安装GraphViz‘s executables.

problem solved:

You need to install the GraphViz package <http://www.graphviz.org/> so that graph.dag can invoke dot.

安装完之后,再运行还是报错:Exception: "dot.exe" not found in path.

那是因为你没有将GraphViz安装目录的bin目录放到环境变量的path路径中,dot.exe在那个目录下。

Note: As of version 2.31, the Visual Studio package no longer alters the PATH variable or accesses the registry at all. If you wish to use the command-line interface to Graphviz or are using some other program that calls a Graphviz program, you will need to set the PATH variable yourself.

设置完如果还是报同样的错误,你需要重启pyhon IDE.

REF.

[1]http://stackoverflow.com/questions/27666846/pydot-invocationexception-graphvizs-executables-not-found

[2]http://markmail.org/message/coebrty3itq426c2

[3]http://stackoverflow.com/questions/18438997/why-is-pydot-unable-to-find-graphvizs-executables-in-windows-8

[4]http://www.graphviz.org/Download_windows.php

InvocationException: GraphViz's executables not found