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

import pydotplus
from io import StringIO
dot_data = StringIO()
tree.export_graphviz(clf, out_file=dot_data, feature_names=['age','sex','1st_class','2nd_class', '3rd_class'])
graph = pydotplus.graph_from_dot_data(dot_data.getvalue())
graph.write_png('titanic.png')
from IPython.core.display import Image
Image(filename='titanic.png')

查阅资料后发现,原来我没有安装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的更多相关文章

  1. Python决策树可视化:GraphViz's executables not found的解决方法

    参考文献: [1]Python决策树可视化:GraphViz's executables not found的解决方法

  2. python中GraphViz's executables not found的解决方法以及决策树可视化

    出现GraphViz's executables not found报错很有可能是环境变量没添加上或添加错地方. 安装pydotplus.graphviz库后,开始用pydotplus.graph_f ...

  3. 解决GraphViz's executables not found

    用python做决策树可视化时,出现了下面的错误: 于是安装Graphviz,并将其添加到path的环境变量. Graphviz下载 提取码:fmst 但是已经安装了pydotplus且import之 ...

  4. ubuntu 绘制lenet网络结构图遇到的问题汇总

    Couldn't import dot_parser, loading of dot files will not be possible的问题 1 .sudo pip uninstall pypar ...

  5. 【疑难杂症】关于用pydotplus生成iris.pdf报错问题

    在使用刘建平老师博客中DecisionTreeClassifier实例时,遇到报错:InvocationException: GraphViz's executables not found 源代码如 ...

  6. Python——graphviz及pydotplus安装步骤

    Python——graphviz及pydotplus安装步骤 一.安装Graphviz 网站:http://www.graphviz.org/download/ 下载msi文件 直接安装,完成之后添加 ...

  7. [决策树]西瓜数据graphviz可视化实现

    [决策树]西瓜数据graphviz可视化实现 一.问题描述: 使用西瓜数据集构建决策树,并将构建的决策树进行可视化操作. 二.问题简析: 首先我们简单的介绍一下什么是决策树.决策树是广泛用于分类和回归 ...

  8. web安全之机器学习入门——3.2 决策树与随机森林

    目录 简介 决策树简单用法 决策树检测P0P3爆破 决策树检测FTP爆破 随机森林检测FTP爆破 简介 决策树和随机森林算法是最常见的分类算法: 决策树,判断的逻辑很多时候和人的思维非常接近. 随机森 ...

  9. Ubuntu pydot failed to call GraphViz.Please install GraphViz 解决方法

    如果遇到: OSError: `pydot` failed to call GraphViz.Please install GraphViz (https://www.graphviz.org/) a ...

随机推荐

  1. C++操作MySQL大量数据插入效率低下的解决方法

    #include <iostream> #include <winsock2.h> #include <string> #include "mysql.h ...

  2. linux git 推送空文件夹

    /********************************************************************************* * linux git 推送空文件 ...

  3. 【海洋女神原创】知识普及:IS版本命名规则和高低关系

    经常有朋友对IS的版本命名不甚了解,有时候在交流的时候就会造成误会,在这里做一下普及. IS最早出名的版本是IS6.22,这是个非常古老的版本的,但是在IS历史上有不可磨灭的贡献. 之后很长一段时间内 ...

  4. 分布式系统(Distributed System)资料

    这个资料关于分布式系统资料,作者写的太好了.拿过来以备用 网址:https://github.com/ty4z2008/Qix/blob/master/ds.md 希望转载的朋友,你可以不用联系我.但 ...

  5. Web程序员常见的5个错误及解决方案

    我是那种脾气暴躁的web用户,但我认为正是如此才驱使我成为一名良好的web开发人员.我会对那些会导致使用网站变得困难的事情恼火,我认为事情越简单越方便越好.这里有五个常见的可用性错误,以及如何避免它们 ...

  6. Servlet-RequestDispatcher.forward方法

    forward方法与Include方法非常相似,但有5点不同 1,在调用forward方法之前,输出缓冲区的数据会被清空,也就是说,在使用forward方法进行请求转发时,只可能输出别转发的web资源 ...

  7. e

    frame问题 以下面的frame为例: ? 1 <frame  src=”xxx.html”  id=”frameId”  name=”frameName”  /> (1)访问frame ...

  8. Ionic2学习笔记

    Component nav: <ion-nav [root] = 'rootComponent'></ion-nav> ....import {Nav} from 'ionic ...

  9. 向内存0:200~0:23f依次传送数据0~3fh

    只能用字节为单位传送了. assume cs:sad sad segment start: mov ax, 20h mov ds, ax mov cx, 40h s: mov [bx], bl inc ...

  10. window.onload用法详解:

    网页中的javaScript脚本代码往往需要在文档加载完成后才能够去执行,否则可能导致无法获取对象的情况,为了避免这种情况的发生,可以使用以下两种方式: 一.将脚本代码放在网页的底端,这样在运行脚本代 ...