我正在关注任意树包的documentation来渲染图表。请注意我已经使用
在我的Mac上安装了graphvizpip3 install graphviz
当我尝试执行此
时RenderTreeGraph(udo).to_picture("udo.png")
我得到以下错误
追踪(最近一次通话): 文件“”,第1行,in RenderTreeGraph(UDO).to_picture( “udo.png”) 文件“/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/anytree/dotexport.py”,第51行,在to_picture中 check_call(CMD) 在check_call中输入文件“/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py”,第286行 retcode = call(* popenargs,** kwargs) 文件“/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py”,第267行,正在通话中 与Popen(* popenargs,** kwargs)一样: 文件“/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py”,第707行, init restore_signals,start_new_session) _execute_child中的文件“/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py”,第1326行 raise child_exception_type(errno_num,err_msg) FileNotFoundError:[Errno 2]没有这样的文件或目录:'dot'
请帮我渲染树
答案 0 :(得分:3)
我得到了同样的错误。我还用pip3来安装graphviz。但是当我使用以下命令安装graphviz时,它解决了我的问题。
sudo apt install graphviz
答案 1 :(得分:0)
请执行以下步骤:
graphviz
的安装位置。通常有一个bin
子目录。将路径复制到文件dot
所在的位置。 (只是目录)PATH
变量并附加上面的路径。请在您的计算机上询问谷歌如何执行此操作。HTH