Графвиз в Анаконде Питон - PullRequest
0 голосов
/ 23 октября 2018

Для моей лекции я должен запустить Graphviz в Anaconda, но я не работал.

Я запускаю все команды, как здесь:

Anaconda - Graphviz - не могу импортировать после установки

Все работает:

import graphviz as gv

def dot_graph(R):
    """This function takes binary relation R as inputs and shows this relation as
       a graph using the module graphviz.
    """
    dot = gv.Digraph()
    Nodes = { tripleToStr(a) for (a,b) in R } | { tripleToStr(b) for (a,b) in R }
    for n in Nodes:
        dot.node(n)
    for (x, y) in R:
        dot.edge(tripleToStr(x), tripleToStr(y))
    return dot

это работает без ошибок, но когда я запускаю это:

dot = dot_graph(R)
dot

эта ошибка возникает

---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
C:\ProgramData\Anaconda3\lib\site-packages\graphviz\backend.py in pipe(engine, format, data, quiet)
    160             stdout=subprocess.PIPE, stderr=subprocess.PIPE,
--> 161             **POPEN_KWARGS)
    162     except OSError as e:

C:\ProgramData\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)
    755                                 errread, errwrite,
--> 756                                 restore_signals, start_new_session)
    757         except:

C:\ProgramData\Anaconda3\lib\subprocess.py in _execute_child(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)
   1154                                          os.fspath(cwd) if cwd is not None else None,
-> 1155                                          startupinfo)
   1156             finally:

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

During handling of the above exception, another exception occurred:

ExecutableNotFound                        Traceback (most recent call last)
C:\ProgramData\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:

C:\ProgramData\Anaconda3\lib\site-packages\graphviz\files.py in _repr_svg_(self)
    104 
    105     def _repr_svg_(self):
--> 106         return self.pipe(format='svg').decode(self._encoding)
    107 
    108     def pipe(self, format=None):

C:\ProgramData\Anaconda3\lib\site-packages\graphviz\files.py in pipe(self, format)
    123         data = text_type(self.source).encode(self._encoding)
    124 
--> 125         outs = backend.pipe(self._engine, format, data)
    126 
    127         return outs

C:\ProgramData\Anaconda3\lib\site-packages\graphviz\backend.py in pipe(engine, format, data, quiet)
    162     except OSError as e:
    163         if e.errno == errno.ENOENT:
--> 164             raise ExecutableNotFound(args)
    165         else:  # pragma: no cover
    166             raise

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

<graphviz.dot.Digraph at 0x2352f0f19b0>

Я пытался переустановить все и очистить, но это тоже не работает.

С наилучшими пожеланиями

...