Why is pydot unable to find GraphViz's executables in Windows 8?

前端 未结 27 2563
醉酒成梦
醉酒成梦 2020-11-27 14:26

I have GraphViz 2.32 installed in Windows 8 and have added C:\\Program Files (x86)\\Graphviz2.32\\bin to the System PATH variable. Still pydot is unable to find its executab

相关标签:
27条回答
  • 2020-11-27 14:53

    you can use pydotplus instead of pydot.then follow the belows:

    First, find C:\Users\zhangqianyuan\AppData\Local\Programs\Python\Python36\Lib\site-packages\pydotplus

    Second, open graphviz.py

    Third, find line 1925 - line 1972, find the function def create(self, prog=None, format='ps'):

    Final, in the function:

    1. find:

      if prog not in self.progs:
          raise InvocationException(
              'GraphViz\'s executable "%s" not found' % prog)
      

      `

      if not os.path.exists(self.progs[prog]) or \
              not os.path.isfile(self.progs[prog]):
          raise InvocationException(
              'GraphViz\'s executable "{}" is not'
              ' a file or doesn\'t exist'.format(self.progs[prog])
          )
      
    2. between the two blocks add this(Your Graphviz's executable path):

      self.progs[prog] = "C:/Program Files (x86)/Graphviz2.38/bin/gvedit.exe"

    3. after adding the result is:

      if prog not in self.progs:
          raise InvocationException(
              'GraphViz\'s executable "%s" not found' % prog)
      
      self.progs[prog] = "C:/Program Files (x86)/Graphviz2.38/bin/gvedit.exe"
      
      if not os.path.exists(self.progs[prog]) or \
              not os.path.isfile(self.progs[prog]):
          raise InvocationException(
              'GraphViz\'s executable "{}" is not'
              ' a file or doesn\'t exist'.format(self.progs[prog])
          )
      
    4. save the changed file then you can run it successfully.

    5. you'd better save it as bmp file because png file will not work. picture is here

    0 讨论(0)
  • 2020-11-27 14:55

    Here is what I did for the above mentioned problem. I'm using windows 10 os and python 3.6.5

    1. Install PIP by clicking here

    2. open command prompt and type command "pip install graphviz"

    3. go to my computer(this pc) and search with the keyword "graphviz"

    4. open the graphviz folder and copy its path and save it in notepad

    5. In graphviz look for the bin folder and copy the folder by right click of your mouse

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

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

    8. head to control panel>system and security> system settings> advanced settings> environmental variables> add new path

    9. add the path that you copied in notepad and click a series of "ok"

    that's it now you can enjoy using graphviz

    0 讨论(0)
  • 2020-11-27 14:56

    The solution is easy, you just need to download and install the Graphviz, from here.

    Then set the path variable to the bin directory, in my case it was C:\Program Files (x86)\Graphviz2.38\bin. Last, do the conda install python-graphviz and it should work fine.

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