graphviz.backend.ExecutableNotFound:无法执行['dot','-Tpng'],请确保Graphviz可执行文件位于系统的PATH中 [英] graphviz.backend.ExecutableNotFound: failed to execute ['dot', '-Tpng'], make sure the Graphviz executables are on your systems' PATH
问题描述
我一小时都找不到解决此问题的方法,因此决定最好在这里提问.在此处,没有与我的情况相符的详细说明.
I wasn't able to find any solution to this issue for one hour and decided better to ask here. The only rich info is given here with no detailed instructions to match my case.
我在Windows 10上,使用PyCharm连接到离线Ubuntu 16.04服务器以尝试一些机器学习分类.
I am on Windows 10, using PyCharm to connect to offline Ubuntu 16.04 server to try some machine learning classification.
代码工作到一定程度,然后抛出该代码
The code is working to some point, then throwing this
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:
之外没有任何输出.
I checked via pip list
that I do have graphviz
version 0.13.2
on Ubuntu server. One suggested in the above given link that the output of whereis dot
should be added as os.environ["PATH"] += os.pathsep + 'OUTPUT'
to the file to be run, but there isn't any output except dot:
.
在本地,我还检查了我是否具有相同的graphviz
版本0.13.2
.
Locally, I also checked that I have the same graphviz
version 0.13.2
.
推荐答案
尝试sudo apt-get install graphviz
这篇关于graphviz.backend.ExecutableNotFound:无法执行['dot','-Tpng'],请确保Graphviz可执行文件位于系统的PATH中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!