2017-08-17 57 views
0

我想显示的树输出,但是当我运行下面的脚本,我收到一个错误,如:的GraphViz的可执行文件未找到:蟒蛇-3

InvocationException:GraphViz的的可执行文件未找到

我在这里搜索了类似的话题,但大多数都与Mac相关。我使用Windows 10 64位操作系统,并使用Anaconda-3 64位。我很想听听你的建议。

#Displaying the decision tree 
from sklearn import tree 
#from StringIO import StringIO 
from io import StringIO 
#from StringIO import StringIO 
from IPython.display import Image 
out = StringIO() 
tree.export_graphviz(classifier, out_file=out) 

import pydotplus 
graph=pydotplus.graph_from_dot_data(out.getvalue()) 
Image(graph.create_png()) 

编辑:我已经安装了再次的graphviz和pydotplus模块,但现在还在工作。

回答

0

我有同样的问题。这里是((Win10,Anaconda3,Jupyter笔记本,蟒蛇3.X)

  1. 下载解决方案和安装https://graphviz.gitlab.io/_pages/Download/Download_windows.html

  2. 畅达安装graphviz的

  3. 添加安装的Graphviz路径(C:... \ graphviz \ bin)至 控制面板>系统和安全>系统>高级系统设置>环境变量>路径>编辑>新建

  4. 非常重要:重新启动Jupyter笔记本/机器。我试过重新启动机器,它工作。

这个问题的答案对于不同的操作系统在这里:Graphviz's executables are not found (Python 3.4)