Pythonでfailed to execute ['dot', '-Tpng', '-O', 'tmp'], make sure the Graphviz executables are on your systems' PATHと出た時の対処方法
スポンサーリンク
Pythonのscikit-learn の決定木を勉強中に発生したエラー対処方法です(Python 3.5.2)。graphvizをimportしようとした所、下記エラーが発生。
ImportError: No module named 'graphviz'
そこで下記コードを実行してから再度importを試したところ、
pip install graphviz
今度は下記のようなエラーが発生。
ExecutableNotFound: failed to execute ['dot', '-Tpng', '-O', 'tmp'], make sure the Graphviz executables are on your systems' PATH
こちらによると、Pythonパッケージのほかにシステム側にもインストールしないといけないらしいです。CentOSを使っているので下記でインストール。
sudo yum install graphviz
Ubuntuの場合は、
sudo apt-get install graphviz
これでエラー無く使えるようになりました。