简体   繁体   中英

failed to execute ['dot', '-Kdot', '-Tsvg'], make sure the Graphviz executables are on your systems' 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

And it give me this error:

failed to execute ['dot', '-Kdot', '-Tsvg'], make sure the Graphviz executables are on your systems' PATH

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

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

And like that: conda install python-graphviz

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

Someove have an idea how to resolve this error?

Thank you.

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. Open a terminal and enter vim.zshrc (I use zsh)
  2. Insert export PATH="/usr/local/opt/graphviz/bin:$PATH"
  3. Save and quit (:wq)

This worked for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM