【发布时间】:2021-04-23 00:37:57
【问题描述】:
我将它与我的数据库中的决策树模型一起使用:
dot_data = tree.export_graphviz(pipeline.named_steps['classifier'], out_file=None,
feature_names = categorical_feature_names + numerical_features,
class_names=[str(el) for el in pipeline.named_steps.classifier.classes_],
filled=True, rounded=True,
special_characters=True)
graph = graphviz.Source(dot_data)
graph
它给了我这个错误:
failed to execute ['dot', '-Kdot', '-Tsvg'], make sure the Graphviz executables are on your systems' PATH
我在这里阅读,而不是在我的笔记本上安装它以获得正确的路径:https://github.com/xflr6/graphviz/issues/68
我是这样写的:conda install -c conda-forge python-graphviz
就像这样:conda install python-graphviz
Botk 工作,但他们都没有解决错误,我仍然得到了她。
有人知道如何解决此错误?
谢谢。
【问题讨论】:
-
您显然还没有安装 GraphViz。
python-graphviz只是一个用于与应用程序对话的 Python 模块,而不是应用程序本身。
标签: python python-3.x graphviz