因为任意树(anytree)包的某些功能需要使用graphviz,所以我安装了graphviz。我已经将代码"from anytree.exporter import DotExporter"添加到Python文档中,并定义了树的根节点。然而,当我尝试使用'DotExporter(root).to_picture('root.png')'命令生成png和dot文件时,出现了"FileNotFoundError: [WinError 2] The system cannot find the file specified"错误消息。我已经尝试了各种解决方案,但没有成功。最终,我找到了一个解决方法:使用命令 'DotExporter(root).to_dotfile('root.dot')' 生成.dot文件,并在在线工具http://www.webgraphviz.com/ 或 http://sandbox.kidstrythisathome.com/erdos/ 中打开文件并生成图形。
python-graphviz
软件包。这似乎有点混乱:https://github.com/ContinuumIO/anaconda-issues/issues/1666 - darthbith