2016-10-19 50 views
0

昨天我通過在命令行中通過pip安裝pydot軟件包。 我可以導入包,甚至創建一個對象,但是當我想創建一個圖表:Pydot不會創建圖表

graph.write_jpg('example1_graph.jpg') 

我收到以下錯誤:

Exception: "dot.exe" not found in path. 
+1

你在使用什麼操作系統? –

+0

Windows 7 Enterprise 64 – Westerby

回答

0

嘗試手動添加的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. 
""" 
+0

嗨,謝謝你的回答。我有一個問題,但執行時: – Westerby

+0

pydot.find_graphviz() 我收到一個錯誤: – Westerby

+0

AttributeError:模塊'pydot'沒有屬性'find_graphviz' – Westerby