小编pur*_*ich的帖子

如何确定Graphviz可执行文件在系统的PATH中?

我正在Sublime Text 3上使用Python 3使用Graphviz。运行此代码时:

data = tree.export_graphviz(dtGini[55], out_file = None)
graph = graphviz.Source(data)
graph.render("testingthis")
Run Code Online (Sandbox Code Playgroud)

我得到这些错误:

FileNotFoundError: [WinError 2] The system cannot find the file specified

During handling of the above exception, another exception occurred:

graphviz.backend.ExecutableNotFound: failed to execute ['dot', '-Tpdf', '-O', 'testingthis'], make sure the Graphviz executables are on your systems' PATH
Run Code Online (Sandbox Code Playgroud)

似乎找不到所需的文件。在Sublime Text 3中,我对Conda的用户设置是:

data = tree.export_graphviz(dtGini[55], out_file = None)
graph = graphviz.Source(data)
graph.render("testingthis")
Run Code Online (Sandbox Code Playgroud)

我可以从控制面板中获取以下环境变量:

C:\ProgramData\Miniconda3\Scripts\
C:\ProgramData\Miniconda3\
C:\ProgramData\Miniconda3\conda-meta\history
C:\Users\X\AppData\Local\conda\conda\pkgs
C:\Users\X\AppData\Local\conda\conda\pkgs\graphviz-2.38-hfd603c8_2\Library\bin
C:\Users\X\AppData\Local\conda\conda\pkgs\graphviz-2.38-hfd603c8_2\Library\bin\dot.exe
Run Code Online (Sandbox Code Playgroud)

在Anaconda提示符下,当我输入Python时,按Enter键,然后输入“ import graphviz”,我没有收到任何错误。在Sublime Text 3中,如果我只有诸如graph.py之类的文件

import graphviz
Run Code Online (Sandbox Code Playgroud)

它执行没有任何错误。 …

python graphviz scikit-learn anaconda

1
推荐指数
2
解决办法
4565
查看次数

标签 统计

anaconda ×1

graphviz ×1

python ×1

scikit-learn ×1