我需要通过pydot构建一个pythonic图解决方案,并尝试运行一个简单的代码,如:
import pydot
graph = pydot.Dot(graph_type='graph')
i=1
edge = pydot.Edge("A", "B%d" % i)
graph.add_edge(edge)
graph.write_png('graph.png')
Run Code Online (Sandbox Code Playgroud)
这是为了在png文件上构建一个简单的图形(A-B1).在解决了很多错误配置后,现在我得到了:
Traceback (most recent call last):
File "/Users/zallaricardo/Documents/Python/test_png.py", line 7, in <module>
graph.write_png('graph.png')
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pydot.py", line 1809, in <lambda>
lambda path, f=frmt, prog=self.prog : self.write(path, format=f, prog=prog))
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pydot.py", line 1911, in write
dot_fd.write(self.create(prog, format))
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pydot.py", line 2023, in create
status, stderr_output) )
pydot.InvocationException: Program terminated with status: 1. stderr follows: Format: "png" not recognized. Use one of:
logout
Run Code Online (Sandbox Code Playgroud)
到目前为止,找不到我特定环境的直接解决方案.有关如何修复它的任何提示?需要为python 2.7和mac os x 10.9工作. …