【问题标题】:"RuntimeError: Make sure the Graphviz executables are on your system's path" after installing Graphviz 2.38安装 Graphviz 2.38 后“运行时错误:确保 Graphviz 可执行文件位于系统路径上”
【发布时间】:2016-05-05 23:52:38
【问题描述】:

我下载了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

有人有这方面的经验吗?

【问题讨论】:

    标签: python installation graphviz


    【解决方案1】:

    麦克和大苏尔。 Python 3.8.6 w/vs 代码。虽然它应该包含在图表包中,但我不得不手动安装 graphviz。

    (mymltools) ➜  infrastructure git:(master) pip list
    Package    Version
    ---------- -------
    diagrams   0.18.0
    graphviz   0.13.2
    Jinja2     2.11.2
    MarkupSafe 1.1.1
    pip        20.3.2
    setuptools 51.0.0
    wheel      0.36.2
    

    运行图表失败。然后手动运行

    pipenv install graphviz
    

    像魅力一样工作。

    【讨论】:

      【解决方案2】:

      MACOS - 蒙特雷解决方案

      1. 打开:终端
      2. 运行:pip install graphviz
      3. 运行:brew install graphviz
      4. 关闭:航站楼
      5. 开放:Anaconda(Jupyter 或 Spyder)
      6. 运行:import os
      7. os.environ["PATH"] += os.pathsep + "/usr/local/Cellar/graphviz/2.49.3/bin/dot"

      (在修复错误之前,您必须每次运行此操作。) 棘手的部分是找到点文件。它是 brew 安装包的位置。 (但它应该类似于我给出的路径。) 运行测试:

      import mglearn as mglearn
      mglearn.plots.plot_animal_tree()
      

      希望你现在可以出发了!

      【讨论】:

        【解决方案3】:

        我使用的是 windows10,我尝试在程序文件中安装 graphwiz 并设置路径:对我不起作用

        试过

        conda install -c anaconda graphviz
        

        没用。

        然后尝试

        conda install python-graphviz
        

        成功了,看来我们的 python 编译器无法访问 Graphwiz。因此python-graphwize 起作用了。 pip install graphviz 也没有用。

        【讨论】:

          【解决方案4】:

          尝试在 python 中执行此操作 导入系统 !conda install --yes --prefix {sys.prefix} graphviz 导入graphviz

          【讨论】:

          • 请在您的回答中添加更多详细信息,例如为什么这样可以解决问题
          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 2021-04-23
          • 2017-07-03
          • 2020-05-25
          • 2017-12-18
          • 2019-10-04
          • 2022-11-16
          • 1970-01-01
          相关资源
          最近更新 更多