InvocationException: GraphViz's executables not found
当我在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.
[2]http://markmail.org/message/coebrty3itq426c2
[4]http://www.graphviz.org/Download_windows.php
InvocationException: GraphViz's executables not found的更多相关文章
- Python决策树可视化:GraphViz's executables not found的解决方法
参考文献: [1]Python决策树可视化:GraphViz's executables not found的解决方法
- python中GraphViz's executables not found的解决方法以及决策树可视化
出现GraphViz's executables not found报错很有可能是环境变量没添加上或添加错地方. 安装pydotplus.graphviz库后,开始用pydotplus.graph_f ...
- 解决GraphViz's executables not found
用python做决策树可视化时,出现了下面的错误: 于是安装Graphviz,并将其添加到path的环境变量. Graphviz下载 提取码:fmst 但是已经安装了pydotplus且import之 ...
- ubuntu 绘制lenet网络结构图遇到的问题汇总
Couldn't import dot_parser, loading of dot files will not be possible的问题 1 .sudo pip uninstall pypar ...
- 【疑难杂症】关于用pydotplus生成iris.pdf报错问题
在使用刘建平老师博客中DecisionTreeClassifier实例时,遇到报错:InvocationException: GraphViz's executables not found 源代码如 ...
- Python——graphviz及pydotplus安装步骤
Python——graphviz及pydotplus安装步骤 一.安装Graphviz 网站:http://www.graphviz.org/download/ 下载msi文件 直接安装,完成之后添加 ...
- [决策树]西瓜数据graphviz可视化实现
[决策树]西瓜数据graphviz可视化实现 一.问题描述: 使用西瓜数据集构建决策树,并将构建的决策树进行可视化操作. 二.问题简析: 首先我们简单的介绍一下什么是决策树.决策树是广泛用于分类和回归 ...
- web安全之机器学习入门——3.2 决策树与随机森林
目录 简介 决策树简单用法 决策树检测P0P3爆破 决策树检测FTP爆破 随机森林检测FTP爆破 简介 决策树和随机森林算法是最常见的分类算法: 决策树,判断的逻辑很多时候和人的思维非常接近. 随机森 ...
- Ubuntu pydot failed to call GraphViz.Please install GraphViz 解决方法
如果遇到: OSError: `pydot` failed to call GraphViz.Please install GraphViz (https://www.graphviz.org/) a ...
随机推荐
- hibernate.hbm2ddl.auto配置详解
hibernate.cfg.xml 中hibernate.hbm2ddl.auto配置节点如下:<properties><property name="hibernate. ...
- 自定义AlertDialog的样式
一.在XML中定义好要显示的AlertDialog的布局 二.在代码中创建alertdialog 对象 AlertDialog dialog = new AlertDialog.Builder(thi ...
- vs2013提高编译速度
最近做新的项目,很多库是之前项目积累下来的库.在windows下使用的IDE是vs2013,整体编译的时候,明显感觉编译速度较慢,文件是一个一个编的. 从编译器本身的角度,vs2013是提供了加快编译 ...
- 关于raid的理解
缘起 公司部署业务的时候,6块盘需要做raid,以前还没有用过所以不知道,临时才去百度看了一下相关知识. 部署 当前可以用软raid与硬raid,软raid系统上建立,占用CPU与IO资源;硬RAID ...
- C#中as用法
在程序中,进行类型转换时常见的事,C#支持基本的强制类型转换方法,例如 Object obj1 = new NewType();NewType newValue = (NewType)obj1;这样强 ...
- jmeter 中的 Beanshell 使用
一.操作变量:通过使内置对象vars可以对变量进行存取操作 a) vars.get("name"):从jmeter中获得变量值 b) vars.put("key" ...
- HTML5学堂,感谢您一年的陪伴(上)
在HTML学堂将满一周岁之际,感谢再过去的一年里支持和关注它的每一个小伙伴.有了你们的支持,HTML5学堂才能更好的走下去.我们将会把这一年的积累重新体现在HTML5学堂的官网上.HTML5学堂将会全 ...
- CE取系统时间值
取时间值: void GetTime() { //取时间值 SYSTEMTIME st = {}; // 时间结构体 GetLocalTime(&st); // 把获取的系统时间信息存储到SY ...
- ubuntu 配置vim(vimrc)
打开终端:ctrl+alt+t 进入vim文件:cd /etc/vim 打开vimrc文件:sudo gedit vimrc 然后在行末if语句前加上下面的内容," 这个符号为注释,后面内 ...
- android之animation
Android Animation一共有四种 Alpha: 淡入淡出效果 Scale: 缩放效果 Rotate: 旋转效果 Translate:移动效果 使用Tweened Animations的步 ...