1. 程式人生 > >決策樹視覺化時GraphViz's executables not found的解決方法

決策樹視覺化時GraphViz's executables not found的解決方法

用python做決策樹視覺化時,安裝了Graphviz,並將其新增到path的環境變數,並且已經安裝了pydotplus且import之後,仍然會出現GraphViz’s executables not found問題,可用以下程式碼解決:

import os     
os.environ["PATH"] += os.pathsep + 'C:/Program Files (x86)/Graphviz2.38/bin/'

其中C:/Program Files (x86)/Graphviz2.38/bin/是安裝Graphviz的bin所在的路徑。