This is the first post in about a year. This time it is a method to install graphviz on jupyter / windows10.
1.ポイント 2. Installation 3. Find the location of graphviz 4. Pass through 5. Confirm
Building a machine learning / AI environment on Windows is really hard! There are so many traps that the old man is about to cry. GPU settings (past article. Please be careful about version matching and refer to it), a dictionary that is strong against new words Neologd (cleared with "subsytem for Linux") Click here is recommended), and this time graphviz etc. I really referred to many sites, but in the end it was not enough to just install it. The point is ** "pass firmly" **! As I found out later, it was properly written on the Official Site.
Quoted from the official website
Make sure that the directory containing the dot executable is on your systems’ path.
Because I wanted to put it under anaconda
conda install graphviz
I used, but the familiar
pip install graphviz
But I think it's okay. Also, there were people who pip dot, but in my environment graphviz was all that was needed.
You can find out where it is by searching the drive containing graphviz (mostly c drive) from Explorer. perhaps ** "\ anaconda3 \ Lib \ site-packages" **? 「\anaconda3\Library\bin」 I think it's around. Make a copy of the file location (path).
It's important, so I'll explain it a little carefully so that even beginners like me can easily understand it.
** STEP1. Display the "Control Panel". ** **
** STEP2. Display the "System screen". ** **
** STEP3. Display the "Environment Variables Screen". ** **
** STEP4. "Edit Path-> New-> Graphviz Path Setting" **
That's it. Let's check if it works properly.
I referred to here. (Exhibitor) http://swdrsker.hatenablog.com/entry/2017/05/19/205409
from graphviz import Digraph
G = Digraph(format="png")
G.attr("node", shape="square", style="filled")
G.edge("start","state1",label="0.8")
G.edge("start","state2",label="0.2")
G.edge("state1","state1",label="0.5")
G.edge("state2","state2", label="0.8")
G.edge("state1","state2",label="0.5")
G.edge("state2","end",label="0.2")
G.edge("end","count",label="1.0")
G.edge("count","start",label="1.0")
G.node("start", shape="circle", color="pink")
G.render("graphs") #png/Directly below
#Illustrated
from IPython.display import Image
Image('graphs.png')
It is drawn neatly. I'm glad.
*) I think that my method may not work because it depends heavily on the environment. Please feel free to ask any questions if it helps me as much as I can.
Recommended Posts