pydot and graphviz error: Couldn't import dot_parser, loading of dot files will not be possible

后端 未结 14 1239
臣服心动
臣服心动 2020-11-28 01:15

When I run a very simple code with pydot

import pydot
graph = pydot.Dot(graph_type=\'graph\')

for i in range(3):

  edge = pydot.Edge(\"king\", \"lord%d\" %         


        
相关标签:
14条回答
  • 2020-11-28 02:15

    What I did at the end after so many tries from what i saw here (pseudo sequence for it to work for networkx ) :

    apt-get remove python-pydot
    pip install pydotplus
    apt-get install libcgraph6
    apt-get install python-pygraphviz
    
    
    # pip freeze | grep pydot
     pydotplus==2.0.2
    # pip freeze | grep pyparsing
    pyparsing==2.2.0
    # pip freeze | grep graphviz
    pygraphviz==1.2
    # python -c 'import pydotplus'
    #
    
    0 讨论(0)
  • 2020-11-28 02:21

    There are now at least 2 more versions that appear to support PyParsing-2 and Python-3:

    • PyDotPlus by Carlos Jenkins with a nice travis buildbot and fancy documentation. However you will need to change its folder name from site-packages\pydotplus to site-packages\pydot for it to work with existing programs that import pydot.
    • pydot3k by bmcorser. Sadly, did not work!
    • prologic/pydot by James Mills linked to from the official pydot Google code page as ...

      a branch for Python 3 compatibility

    • and here is a working link to David Villa's pydot2 which works fine: https://pypi.python.org/pypi/pydot2/1.0.32

    0 讨论(0)
提交回复
热议问题