无法执行['.dot','-Kdot','-Tsvg'],请确保Graphviz可执行文件位于系统的PATH中 [英] failed to execute ['dot', '-Kdot', '-Tsvg'], make sure the Graphviz executables are on your systems' PATH

查看:115
本文介绍了无法执行['.dot','-Kdot','-Tsvg'],请确保Graphviz可执行文件位于系统的PATH中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在数据库上的决策树模型中使用了它:

I used this with my decision tree model on my database :

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

I read here than I needed it to install it on my notebook to have the proper path : https://github.com/xflr6/graphviz/issues/68

我这样子说:conda install -c conda-forge python-graphviz

I dit it like that : conda install -c conda-forge python-graphviz

像这样:conda install python-graphviz

And like that : conda install python-graphviz

Botk正常工作,但没有一个可以解决错误,但我仍然找到了她.

Botk worked but None of them resolve the error and I still got her.

有人知道如何解决此错误?

Someove have an idea how to resolve this error ?

谢谢.

推荐答案

您需要将graphviz可执行文件添加到PATH.用conda或pip安装模块不是问题.这是我在Mac上使用的解决方案:

You need to add graphviz executable to your PATH. Is not a matter to install the module with conda or pip. This is my solution working with a Mac:

  1. 打开终端并输入 vim .zshrc (我使用zsh)
  2. 插入 export PATH ="/usr/local/opt/graphviz/bin:$ PATH"
  3. 保存并退出(:wq)

这对我有用.

这篇关于无法执行['.dot','-Kdot','-Tsvg'],请确保Graphviz可执行文件位于系统的PATH中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆