Python, not able to graph trees using graphviz with the anytree package

后端 未结 1 459
谎友^
谎友^ 2021-01-23 10:56

So I have installed the anytree package (after great effort; I had to add some environment variables on my system). Having done this I can use almost all functionalities of the

相关标签:
1条回答
  • 2021-01-23 11:53

    Here is my workaround. I was working the examples of "getting started" with the following initial steps:

    Create a tree object as udo and then trying DotExporter(udo).to_picture("udo.png"). This was where I got the same error as OP.

    Assuming you have already installed graphviz and python-graphviz (e.g conda install -c anaconda graphviz python-graphviz) you can output the graph (first saving a dotfile) with this:

    DotExporter(udo).to_dotfile('udo.dot')
    
    from graphviz import Source
    Source.from_file('udo.dot')
    

    Then save image file with this:

    from graphviz import render
    render('dot', 'png', 'udo.dot') 
    
    0 讨论(0)
提交回复
热议问题