1
resposta

O comando de criação da árvore não executa

1.dot_data = tree.export_graphviz(classificador_arvore, filled=True, out_file=None) 2.graph = graphviz.Source(dot_data) 3.graph

estou executando pelo Jupyter e apresenta erro:


FileNotFoundError Traceback (most recent call last) ~\anaconda3\lib\site-packages\graphviz\backend.py in run(cmd, input, capture_output, check, encoding, quiet, *kwargs) 163 try: --> 164 proc = subprocess.Popen(cmd, startupinfo=get_startupinfo(), *kwargs) 165 except OSError as e:

~\anaconda3\lib\subprocess.py in init(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors, text) 799 errread, errwrite, --> 800 restore_signals, start_new_session) 801 except:

~\anaconda3\lib\subprocess.py in executechild(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, unused_start_new_session) 1206 os.fspath(cwd) if cwd is not None else None, -> 1207 startupinfo) 1208 finally:

FileNotFoundError: [WinError 2] O sistema não pode encontrar o arquivo especificado

During handling of the above exception, another exception occurred:

ExecutableNotFound Traceback (most recent call last) ~\anaconda3\lib\site-packages\IPython\core\formatters.py in call(self, obj) 343 method = get_real_method(obj, self.print_method) 344 if method is not None: --> 345 return method() 346 return None 347 else:

~\anaconda3\lib\site-packages\graphviz\files.py in reprsvg_(self) 142 143 def reprsvg_(self): --> 144 return self.pipe(format='svg').decode(self._encoding) 145 146 def pipe(self, format=None, renderer=None, formatter=None, quiet=False):

~\anaconda3\lib\site-packages\graphviz\files.py in pipe(self, format, renderer, formatter, quiet) 169 out = backend.pipe(self._engine, format, data, 170 renderer=renderer, formatter=formatter, --> 171 quiet=quiet) 172 173 return out

~\anaconda3\lib\site-packages\graphviz\backend.py in pipe(engine, format, data, renderer, formatter, quiet) 246 """ 247 cmd, _ = command(engine, format, None, renderer, formatter) --> 248 out, _ = run(cmd, input=data, capture_output=True, check=True, quiet=quiet) 249 return out 250

~\anaconda3\lib\site-packages\graphviz\backend.py in run(cmd, input, capture_output, check, encoding, quiet, **kwargs) 165 except OSError as e: 166 if e.errno == errno.ENOENT: --> 167 raise ExecutableNotFound(cmd) 168 else: 169 raise

ExecutableNotFound: failed to execute ['dot', '-Kdot', '-Tsvg'], make sure the Graphviz executables are on your systems' PATH

1 resposta

Olá Lucas,

A utilização do graphviz no Windows é um pouco complicada mesmo.

Acredito essa dúvida seja a mesma presente neste post do fórum que o Victor respondeu.

https://cursos.alura.com.br/forum/topico-como-instalar-o-graphviz-no-anaconda-aula-arvore-de-decisao-85012

Verifique se a resposta dele resolve o seu problema.