简体   繁体   中英

Installing graphviz in Windows 10 with Anaconda3 and using it through a Jupyter Notebook/Python3

I have been trying unsuccessfuly to use graphviz inside a Jupyter Notebook with Python3 kernel installed via Anaconda3.

When I make a call to graphviz I get the error message:

InvocationException: GraphViz's executables not found

I begun by installing graphviz using conda. Since the exception persisted I installed again graphviz using pip.

There is a post that disccusses this problem in Stackoverflow here: Why is pydot unable to find GraphViz's executables in Windows 8?

I tried to follow the advice.

First I located the graphviz and added its path to the Environment path:

在此处输入图片说明

The path where graphviz is found in my PC is: C:\\ProgramData\\Anaconda3\\Library\\bin\\graphviz

There is no bin directory inside this folder. The folder is flat without any subdirectories.

My system variables:

在此处输入图片说明

In the instructions provided in the aforementioned StackOverFlow post I am told:

now again head back to my computer and search for "pydotplus"

a folder named pydotplus is displayed. Open it and paste the copy of bin folder (of Graphviz) that you copied earlier

I have installed pydotplus:

在此处输入图片说明

However when I search for pydotplus I can not find it:

在此处输入图片说明

When I call again graphviz from inside my Jupyter Notebook I get again the same exception.

from IPython.display import Image  
from sklearn import tree
import pydotplus

# Create DOT data
dot_data = tree.export_graphviz(dt_clf_4, out_file=None, 
                                feature_names= features,  
                                class_names= 'malignant')

# Draw graph
graph = pydotplus.graph_from_dot_data(dot_data)  

# Show graph
Image(graph.create_png())

InvocationException: GraphViz's executables not found

I am not using pydot, but it seems to be using the same executable as graphviz. For me, install graphviz using conda install python-graphviz fixes the missing graphviz executable issue.

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