【问题标题】:graphviz.backend.ExecutableNotFound: failed to execute ['dot', '-Tpng'], make sure the Graphviz executables are on your systems' PATHgraphviz.backend.ExecutableNotFound:未能执行 ['dot', '-Tpng'],请确保 Graphviz 可执行文件位于您系统的路径中
【发布时间】:2020-03-03 06:06:06
【问题描述】:

我在一小时内找不到任何解决此问题的方法,因此决定最好在这里提问。唯一丰富的信息是here,没有详细说明来匹配我的情况。

我在 Windows 10 上,使用 PyCharm 连接离线 Ubuntu 16.04 服务器尝试一些机器学习分类。

代码在某个时候工作,然后抛出这个

Traceback (most recent call last):
  File "/home/user/.local/lib/python3.5/site-packages/graphviz/backend.py", line 159, in run
    proc = subprocess.Popen(cmd, startupinfo=get_startupinfo(), **kwargs)
  File "/usr/lib/python3.5/subprocess.py", line 947, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.5/subprocess.py", line 1551, in _execute_child
    raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: 'dot'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/user/project/2_input/xgboost_loop.py", line 55, in <module>
    xgb.plot_tree(classifier, ax=plt.gca())
  File "/home/user/.local/lib/python3.5/site-packages/xgboost/plotting.py", line 281, in plot_tree
    s.write(g.pipe(format='png'))
  File "/home/user/.local/lib/python3.5/site-packages/graphviz/files.py", line 138, in pipe
    quiet=quiet)
  File "/home/user/.local/lib/python3.5/site-packages/graphviz/backend.py", line 229, in pipe
    out, _ = run(cmd, input=data, capture_output=True, check=True, quiet=quiet)
  File "/home/user/.local/lib/python3.5/site-packages/graphviz/backend.py", line 162, in run
    raise ExecutableNotFound(cmd)
graphviz.backend.ExecutableNotFound: failed to execute ['dot', '-Tpng'], make sure the Graphviz executables are on your systems' PATH

Process finished with exit code 1

我通过 pip list 检查了我在 Ubuntu 服务器上确实有 graphviz 版本 0.13.2。上面给出的链接中建议将whereis dot 的输出作为os.environ["PATH"] += os.pathsep + 'OUTPUT' 添加到要运行的文件中,但除了dot: 之外没有任何输出。

在本地,我还检查了我是否有相同的graphviz 版本0.13.2

【问题讨论】:

    标签: pycharm ubuntu-16.04 graphviz dot


    【解决方案1】:

    试试sudo apt-get install graphviz

    【讨论】:

      【解决方案2】:

      您必须将 graphviz 二进制文件添加到系统 PATH 变量中。在我的系统上C:\Program Files\Graphviz 2.44.1\bin\

      【讨论】:

        猜你喜欢
        • 2021-04-23
        • 2016-05-05
        • 2022-11-16
        • 1970-01-01
        • 1970-01-01
        • 2018-08-23
        • 2016-12-18
        • 2018-07-29
        • 2023-03-06
        相关资源
        最近更新 更多