安装 Graphviz 2.38 后“运行时错误:确保 Graphviz 可执行文件位于系统路径上”

新手上路,请多包涵

我下载 Graphviz 2.38 MSI 版本并安装在文件夹 C:\Python34 下,然后我运行 pip install Graphviz ,一切顺利。在系统路径中,我添加了 C:\Python34\bin 。当我尝试运行测试脚本时,在 filename=dot.render(filename='test') 行中,我收到一条消息

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

我尝试将 "C:\Python34\bin\dot.exe" 放在系统路径中,但它没有工作,我什至创建了一个新的环境变量 "GRAPHVIZ_DOT""C:\Python34\bin\dot.exe" 仍然无法工作, .我尝试卸载 Graphviz 和 pip uninstall graphviz ,然后重新安装并再次 pip install ,但没有任何效果。

整个回溯消息是:

 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

有没有人有这方面的经验?

原文由 liga810 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 980
1 个回答

您应该在系统中安装 graphviz 包(而不仅仅是 python 包)。在 Ubuntu 上你应该尝试:

 sudo apt-get install graphviz

原文由 kame 发布,翻译遵循 CC BY-SA 3.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题