python - 命令 '['dot.bat', '-Kdot', '-Tpdf', '-O', 'hello.gv']' 返回非零退出状态 1. [stderr: b'系统找不到路径已指定。\r\n']
问题描述
Python 模块 graphvis 中的方法 .view() 给出了错误,我只是尝试了graphvis docs中的代码:
# hello.py - http://www.graphviz.org/content/hello
from graphviz import Digraph
g = Digraph('G', filename='hello.gv')
g.edge('Hello', 'World')
g.view()
我收到错误消息:
CalledProcessError: Command '['dot.bat', '-Kdot', '-Tpdf', '-O', 'hello.gv']' returned non-zero exit status 1. [stderr: b'The system cannot find the path specified.\r\n']
顺便说一句 - 文件“hello.gv.pdf”已创建并且没问题。
这意味着 - 安装的库。不要只工作可视化。
我正在研究 Windows Anaconda。
我做了这里显示的所有可能的案例安装没有改变...... 5 小时飞走了 - 什么都没有。
这是一个示例完整列表
(Torch_ML) C:\Users\Vasil>python
Python 3.8.8 (default, Feb 24 2021, 15:54:32) [MSC v.1928 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from graphviz import Digraph
>>>
>>> g = Digraph('G', filename='hello.gv')
>>>
>>> g.edge('Hello', 'World')
>>>
>>> print(g)
digraph G {
Hello -> World
}
>>>
>>> g.view()
The system cannot find the path specified.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "D:\Games\Anaconda\envs\Torch_ML\lib\site-packages\graphviz\files.py", line 282, in view
return self.render(filename=filename, directory=directory,
File "D:\Games\Anaconda\envs\Torch_ML\lib\site-packages\graphviz\files.py", line 243, in render
rendered = backend.render(self._engine, format, filepath,
File "D:\Games\Anaconda\envs\Torch_ML\lib\site-packages\graphviz\backend.py", line 225, in render
run(cmd, capture_output=True, cwd=cwd, check=True, quiet=quiet)
File "D:\Games\Anaconda\envs\Torch_ML\lib\site-packages\graphviz\backend.py", line 185, in run
raise CalledProcessError(proc.returncode, cmd,
graphviz.backend.CalledProcessError: Command '['dot.bat', '-Kdot', '-Tpdf', '-O', 'hello.gv']' returned non-zero exit status 1. [stderr: b'The system cannot find the path specified.\r\n']
解决方案
推荐阅读
- git - 如何连接并推送项目到 gitserver
- ios - 在另一个自定义 ViewController 中更改自定义 UIView 的变量
- azure - azure 网关作为优先流量管理器
- python - driver.title 在带有 python 的 selenium webdriver 中不起作用
- python - Python 在 Windows 中的 Popen 在同一件事上既成功又失败
- spring-boot - 升级到 Spring Boot 2.0.3 时出现断路器和 AbstractCloudConfig 问题
- swift - Q: How to change language PDF page indicator?
- java - Java 字符串停止转义字符操作
- jquery - 不关注动态添加的文本框
- docker - 码头工人服务日志
&码头日志 不打印日志