试了网上的一些方法都没有成功,最后,我在cmd中检测了一下dot的版本,才发现问题。具体操作是:
打开cmd
运行:dot -v
出现问题:There is no layout engine support for “dot”…
运行:dot -c
没有提示(成功)
再次运行dot -v
结果如下图(成功)。详情也可参考:win10安装Graphviz
再次执行上述测试代码,没有报错,nice~
(base) PS C:\Users\HiFuture> dot -v
dot - graphviz version 2.44.1 (20200629.0846)
There is no layout engine support for "dot"
Perhaps "dot -c" needs to be run (with installer's privileges) to register the plugins?
(base) PS C:\Users\HiFuture> dot -c
(base) PS C:\Users\HiFuture> dot -v
dot - graphviz version 2.44.1 (20200629.0846)
libdir = "D:\software\Graphvz2.44.1\Graphviz 2.44.1\bin"
Activated plugin library: gvplugin_dot_layout.dll
Using layout: dot:dot_layout
Activated plugin library: gvplugin_core.dll
Using render: dot:core
Using device: dot:dot:core
The plugin configuration file:
D:\software\Graphvz2.44.1\Graphviz 2.44.1\bin\config6
was successfully loaded.
render : cairo dot dot_json fig gdiplus json json0 map mp pic ps svg tk vml xdot xdot_json
layout : circo dot fdp neato nop nop1 nop2 osage patchwork sfdp twopi
textlayout : textlayout
device : bmp canon cmap cmapx cmapx_np dot dot_json emf emfplus eps fig gif gv imap imap_np ismap jpe jpeg jpg json json0 metafile mp pdf pic plain plain-ext png ps ps2 svg tif tiff tk vml xdot xdot1.2 xdot1.4 xdot_json
loadimage : (lib) bmp eps gif jpe jpeg jpg png ps svg