“RuntimeError: Make sure the Graphviz executables are on your system's path” after installing Graphviz 2.38

匿名 (未验证) 提交于 2019-12-03 02:49:01

问题:

I downloaded Graphviz 2.38 MSI version and installed under folder C:\Python34, then I run pip install Graphviz, everything went well. In system's path I added C:\Python34\bin. When I tried to run a test script, in line filename=dot.render(filename='test'), I got a message

 RuntimeError: failed to execute ['dot', '-Tpdf', '-O', 'test'], make sure the Graphviz executables are on your systems' path 

I tried to put "C:\Python34\bin\dot.exe" in system's path, but it didn't work, and I even created a new environment variable "GRAPHVIZ_DOT" with value "C:\Python34\bin\dot.exe", still not working. I tried to uninstall Graphviz and pip uninstall graphviz, then reinstall it and pip install again, but nothing works.

The whole traceback message is:

Traceback (most recent call last):   File "C:\Python34\lib\site-packages\graphviz\files.py", line 220, in render     proc = subprocess.Popen(cmd, startupinfo=STARTUPINFO)   File "C:\Python34\lib\subprocess.py", line 859, in __init__     restore_signals, start_new_session)   File "C:\Python34\lib\subprocess.py", line 1112, in _execute_child     startupinfo) FileNotFoundError: [WinError 2] The system cannot find the file specified  During handling of the above exception, another exception occurred:  Traceback (most recent call last):   File "C:\Users\Documents\Kissmetrics\curves and lines\eventNodes.py", line 56, in <module>     filename=dot.render(filename='test')   File "C:\Python34\lib\site-packages\graphviz\files.py", line 225, in render     'are on your systems\' path' % cmd) RuntimeError: failed to execute ['dot', '-Tpdf', '-O', 'test'], make sure the Graphviz executables are on your systems' path 

Does anybody have any experience with it?

回答1:

You should install the graphviz package in your system (not just the python package). On Ubuntu you should try:

sudo apt-get install graphviz 


回答2:

This one solved the problem for me on MAC:

  brew install graphviz 


回答3:

import os os.environ["PATH"] += os.pathsep + 'D:/Program Files (x86)/Graphviz2.38/bin/' 

In windows just add these 2 lines in the beginning, where 'D:/Program Files (x86)/Graphviz2.38/bin/' is replaced by the address of where your bin file is.

That solves the problem.



回答4:

For Windows:

  1. Install windows package from: http://www.graphviz.org/Download_windows.php
  2. Install python graphviz package
  3. Add C:\Program Files (x86)\Graphviz2.38\bin to User path
  4. Add C:\Program Files (x86)\Graphviz2.38\bin\dot.exe to System Path

This worked for me!



回答5:

Just add below to your Environmental Variable(system) PATH on Windows

C:\Program Files (x86)\Graphviz2.38\bin

there, you can find .exe files

If not work

Find Graphviz2.38/bin folder in your Program Files not in python lib

Then, add to your PATH

It's important to find a folder where .exe files exist



回答6:

Try conda install graphviz. I had the same problem, I resolved it by mentioned command in MacOS.



回答7:

OSX Sierra, Python 2.7, Graphviz 2.38

Using pip install graphviz and conda install graphviz BOTH resolves the problem.

pip only gets path problem same as yours and conda only gets import error.



回答8:

I had the same issue on Linux with Jupyter.

To solve it I've added the dot library to python sys.path

First: check if dot is installed,

Then:
find his path whereis dot -> /local/notebook/miniconda2/envs/ik2/bin/dot

Finally in python script : sys.path.append("/local/notebook/miniconda2/envs/ik2/bin/dot")



回答9:

First, you should use pip install, and then download another package in http://www.graphviz.org/Download_windows.php and add the install location into the environmental path, then it works.



回答10:

After you've installed the package (link if you haven't), add the path to dot.exe as a new system variable.

Default path is:

C:\Program Files (x86)\Graphviz2.38\bin\dot.exe



回答11:

I had the same error message on Mac OS (El Capitan), using the PyCharm IDE. I had installed Graphviz using brew, as recommended in RZK's answer, and installed the graphviz python package using PyCharm (I could check Graphviz was installed correctly by trying dot -V in a terminal and getting: dot - graphviz version 2.40.1 (20161225.0304)). Yet I was still getting the error message when trying to call Graphviz from PyCharm.

I had to add the path /usr/local/bin in PyCharm options, as recommended in the answer to this question to resolve the problem.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!