私は Python を使用して、 を介してグラフを作成していますpydot.Dot
。
グラフをPNGに書きたいときはpydot.Dot.write_png(...)
. 残念ながら、graphviz ( という関数内find_graphviz
) を見つける段階で失敗します。
ソフトウェアとしてインストールしようとしましたが、Python にインポートする方法がわかりません。
どうすればこの問題を解決できますか?
Graphviz を PATH に追加した後でも、機能しませんでした。私は最終的に pydot.py ファイルに入り、 find_graphviz() のすべてをコメントアウトして、次の行に書き込みました。
`return {'dot': 'C:\\Program Files\\graphviz-2.38\\bin\\dot.exe'}`
それが私のドットファイルがあった場所です。別の場所にあるかもしれません。
Graphviz\bin フォルダーをシステム PATH に手動で追加してみてください。
>>> import pydot
>>> pydot.find_graphviz()
{'dot': 'C:\\Program Files (x86)\\Graphviz 2.28\\bin\\dot.exe'} #...
>>> print pydot.find_graphviz.__doc__
"""
Locate Graphviz's executables in the system.
Tries three methods:
First: Windows Registry (Windows only)
This requires Mark Hammond's pywin32 is installed.
Secondly: Search the path
It will look for 'dot', 'twopi' and 'neato' in all the directories
specified in the PATH environment variable.
Thirdly: Default install location (Windows only)
It will look for 'dot', 'twopi' and 'neato' in the default install
location under the "Program Files" directory.
It will return a dictionary containing the program names as keys
and their paths as values.
If this fails, it returns None.
"""