LoginSignup
27
36

More than 5 years have passed since last update.

Windows で graphviz の導入

Last updated at Posted at 2018-02-07

Dot 言語でグラフを作図するプログラム Graphviz は anaconda + pip で導入できた

一貫した説明が見当たらなかったので、ここにメモしておく。
* Windows 10 x64, anaconda python 3.6, Visual build tools 2015 環境を使用。

ポイント

  • conda コマンドでバイナリの導入
  • pip で python モジュールの導入
  • anaconda prompt で PATH が通っているように見えても動作しない。グローバルな環境変数設定で、Graphviz の バイナリのあるところに PATH を通すと、動作するようになる。

具体的手順

(scipy36) C:\Users\007\Documents>pip install graphviz
Collecting graphviz
  Downloading graphviz-0.8.2-py2.py3-none-any.whl
Installing collected packages: graphviz
Successfully installed graphviz-0.8.2

(scipy36) C:\Users\007\Documents>dot -V
'dot' は、内部コマンドまたは外部コマンド、
操作可能なプログラムまたはバッチ ファイルとして認識されていません。

(scipy36) C:\Users\007\Documents>conda install graphviz
    (中略)
Downloading and Extracting Packages
graphviz 2.38.0: 
    (中略)

(scipy36) C:\Users\007\Documents>dot -V
dot - graphviz version 2.38.0 (20140413.2041)

バイナリがインストールできた。
C:\Users\007\Anaconda3\envs\scipy36\Library\bin\graphviz の下に Graphviz 2.38.0 のバイナリーが導入済みである。(ここでは anaconda の仮想環境 scipy36 の中にインストールした。
しかし、実は Graphviz を起動する段階で ( render() の呼び出し時に )エラーが出る。

graphviz.backend.ExecutableNotFound: failed to execute ['dot', '-Tpng', '-O', 
'graphs'], make sure the Graphviz executables are on your systems' PATH

そこで、Windows のコントロール パネル \ システムとセキュリティ \ システム から、[システムの詳細設定][環境変数] で、PATHC:\Users\007\Anaconda3\envs\scipy36\Library\bin (conda によるバイナリのインストールディレクトリ)を加えると、エラーなく、グラフ画像が描画できるようになる。

以上です。

27
36
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
27
36