FileNotFoundError: [Errno 2] "dot" not found in path.

博客主要围绕解决“FileNotFoundError: [Errno 2] 'dot' not found in path”这一错误展开,虽未提及具体解决方法,但核心是针对该文件路径未找到的问题进行处理。

解决

sudo apt-get install graphviz
--------------------------------------------------------------------------- FileNotFoundError Traceback (most recent call last) File D:\Anaconda3\lib\site-packages\graphviz\backend\execute.py:76, in run_check(cmd, input_lines, encoding, quiet, **kwargs) 75 kwargs['stdout'] = kwargs['stderr'] = subprocess.PIPE ---> 76 proc = _run_input_lines(cmd, input_lines, kwargs=kwargs) 77 else: File D:\Anaconda3\lib\site-packages\graphviz\backend\execute.py:96, in _run_input_lines(cmd, input_lines, kwargs) 95 def _run_input_lines(cmd, input_lines, *, kwargs): ---> 96 popen = subprocess.Popen(cmd, stdin=subprocess.PIPE, **kwargs) 98 stdin_write = popen.stdin.write File D:\Anaconda3\lib\subprocess.py:971, in Popen.__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, user, group, extra_groups, encoding, errors, text, umask, pipesize) 968 self.stderr = io.TextIOWrapper(self.stderr, 969 encoding=encoding, errors=errors) --> 971 self._execute_child(args, executable, preexec_fn, close_fds, 972 pass_fds, cwd, env, 973 startupinfo, creationflags, shell, 974 p2cread, p2cwrite, 975 c2pread, c2pwrite, 976 errread, errwrite, 977 restore_signals, 978 gid, gids, uid, umask, 979 start_new_session) 980 except: 981 # Cleanup if the child failed starting. File D:\Anaconda3\lib\subprocess.py:1440, in Popen._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_gid, unused_gids, unused_uid, unused_umask, unused_start_new_session) 1439 try: -> 1440 hp, ht, pid, tid = _winapi.CreateProcess(executable, args, 1441 # no special security 1442 None, None, 1443 int(not close_fds), 1444 creationflags, 1445 env, 1446 cwd, 1447 startupinfo) 1448 finally: 1449 # Child is launched. Close the parent's copy of those pipe 1450 # handles that only the child should have open. You need (...) 1453 # pipe will not close when the child process exits and the 1454 # ReadFile will hang. FileNotFoundError: [WinError 2] 系统找不到指定的文件。 The above exception was the direct cause of the following exception: ExecutableNotFound Traceback (most recent call last) File D:\Anaconda3\lib\site-packages\IPython\core\formatters.py:972, in MimeBundleFormatter.__call__(self, obj, include, exclude) 969 method = get_real_method(obj, self.print_method) 971 if method is not None: --> 972 return method(include=include, exclude=exclude) 973 return None 974 else: File D:\Anaconda3\lib\site-packages\graphviz\jupyter_integration.py:98, in JupyterIntegration._repr_mimebundle_(self, include, exclude, **_) 96 include = set(include) if include is not None else {self._jupyter_mimetype} 97 include -= set(exclude or []) ---> 98 return {mimetype: getattr(self, method_name)() 99 for mimetype, method_name in MIME_TYPES.items() 100 if mimetype in include} File D:\Anaconda3\lib\site-packages\graphviz\jupyter_integration.py:98, in <dictcomp>(.0) 96 include = set(include) if include is not None else {self._jupyter_mimetype} 97 include -= set(exclude or []) ---> 98 return {mimetype: getattr(self, method_name)() 99 for mimetype, method_name in MIME_TYPES.items() 100 if mimetype in include} File D:\Anaconda3\lib\site-packages\graphviz\jupyter_integration.py:112, in JupyterIntegration._repr_image_svg_xml(self) 110 def _repr_image_svg_xml(self) -> str: 111 """Return the rendered graph as SVG string.""" --> 112 return self.pipe(format='svg', encoding=SVG_ENCODING) File D:\Anaconda3\lib\site-packages\graphviz\piping.py:104, in Pipe.pipe(self, format, renderer, formatter, neato_no_op, quiet, engine, encoding) 55 def pipe(self, 56 format: typing.Optional[str] = None, 57 renderer: typing.Optional[str] = None, (...) 61 engine: typing.Optional[str] = None, 62 encoding: typing.Optional[str] = None) -> typing.Union[bytes, str]: 63 """Return the source piped through the Graphviz layout command. 64 65 Args: (...) 102 '<?xml version=' 103 """ --> 104 return self._pipe_legacy(format, 105 renderer=renderer, 106 formatter=formatter, 107 neato_no_op=neato_no_op, 108 quiet=quiet, 109 engine=engine, 110 encoding=encoding) File D:\Anaconda3\lib\site-packages\graphviz\_tools.py:185, in deprecate_positional_args.<locals>.decorator.<locals>.wrapper(*args, **kwargs) 177 wanted = ', '.join(f'{name}={value!r}' 178 for name, value in deprecated.items()) 179 warnings.warn(f'The signature of {func_name} will be reduced' 180 f' to {supported_number} positional arg{s_}{qualification}' 181 f' {list(supported)}: pass {wanted} as keyword arg{s_}', 182 stacklevel=stacklevel, 183 category=category) --> 185 return func(*args, **kwargs) File D:\Anaconda3\lib\site-packages\graphviz\piping.py:121, in Pipe._pipe_legacy(self, format, renderer, formatter, neato_no_op, quiet, engine, encoding) 112 @_tools.deprecate_positional_args(supported_number=1, ignore_arg='self') 113 def _pipe_legacy(self, 114 format: typing.Optional[str] = None, (...) 119 engine: typing.Optional[str] = None, 120 encoding: typing.Optional[str] = None) -> typing.Union[bytes, str]: --> 121 return self._pipe_future(format, 122 renderer=renderer, 123 formatter=formatter, 124 neato_no_op=neato_no_op, 125 quiet=quiet, 126 engine=engine, 127 encoding=encoding) File D:\Anaconda3\lib\site-packages\graphviz\piping.py:149, in Pipe._pipe_future(self, format, renderer, formatter, neato_no_op, quiet, engine, encoding) 146 if encoding is not None: 147 if codecs.lookup(encoding) is codecs.lookup(self.encoding): 148 # common case: both stdin and stdout need the same encoding --> 149 return self._pipe_lines_string(*args, encoding=encoding, **kwargs) 150 try: 151 raw = self._pipe_lines(*args, input_encoding=self.encoding, **kwargs) File D:\Anaconda3\lib\site-packages\graphviz\backend\piping.py:212, in pipe_lines_string(engine, format, input_lines, encoding, renderer, formatter, neato_no_op, quiet) 206 cmd = dot_command.command(engine, format, 207 renderer=renderer, 208 formatter=formatter, 209 neato_no_op=neato_no_op) 210 kwargs = {'input_lines': input_lines, 'encoding': encoding} --> 212 proc = execute.run_check(cmd, capture_output=True, quiet=quiet, **kwargs) 213 return proc.stdout File D:\Anaconda3\lib\site-packages\graphviz\backend\execute.py:81, in run_check(cmd, input_lines, encoding, quiet, **kwargs) 79 except OSError as e: 80 if e.errno == errno.ENOENT: ---> 81 raise ExecutableNotFound(cmd) from e 82 raise 84 if not quiet and proc.stderr: ExecutableNotFound: failed to execute WindowsPath('dot'), make sure the Graphviz executables are on your systems' PATH <graphviz.graphs.Digraph at 0x1e348e17940>
06-19
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值