我正在尝试显示树输出,但是当我运行下面的脚本时,我收到如下错误:
IncationException:未找到 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 模块,但现在仍然可以工作。
我有同样的问题。这是((Win10,Anaconda3,Jupyter笔记本,python 3.x)的解决方案
下载并安装https://graphviz.gitlab.io/_pages/Download/Download_windows.html https://graphviz.gitlab.io/_pages/Download/Download_windows.html
conda install graphviz
添加graphviz安装路径(C:...\graphviz\bin)到
控制面板 > 系统和安全 > 系统 > 高级系统设置 > 环境变量 > 路径 > 编辑 > 新建
- 非常重要:重新启动您的 Jupyter 笔记本/计算机。我尝试重新启动机器,它成功了。
这个问题针对不同操作系统的回答如下:找不到 Graphviz 的可执行文件(Python 3.4) https://stackoverflow.com/questions/28312534/graphvizs-executables-are-not-found-python-3-4
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)