2017-02-23 15 views
0

Jupyter 노트북에서 아래 코드를 실행해야합니다.Python 3.4 graphviz 문제

from graphviz import Digraph 
dot = Digraph(comment='The Round Table') 
dot.node('A', 'King Arthur') 
dot.node('B', 'Sir Bedevere the Wise') 
dot.node('L', 'Sir Lancelot the Brave') 
dot.edges(['AB', 'AL']) 
dot.edge('B', 'L', constraint='false') 
print(dot.source) 
dot.render('test-output/round-table.gv', view=True) 

사전에 graphviz를 설치해야합니다. 내가 windows8에 graphviz 2.38을 설치 한 후. 'pip install graphviz' 과 'conda install graphviz'도했다. 하지만 난이 오류를 얻을

"RuntimeError에 다음 graphviz를 실행하여 시스템 '경로에 있는지 확인, ['점 ','-Tsvg를 '] 실행하지 못했습니다"나는이를 만들기 위해해야 ​​할 다른 무엇

오류가 사라 졌습니까?

답변

0

python 런타임이 graphviz의 경로를 포함하지 않는 PATH 환경 변수로 실행 중입니다.

는 다음 (py3) 코드 여부를 확인하여이를 확인할 수 있습니다

import os 
print(os.environ['PATH']) 

은은 GraphVIZ가 설치되어있는 디렉토리를 나열한다.

set PATH=%PATH%;this_would_be_the_path_to_your_graphiz_binaries_like_dot 

[1] https://superuser.com/questions/284342/what-are-path-and-other-environment-variables-and-how-can-i-set-or-use-them

: 그렇지 않은 경우, 파이썬을 실행하기 전에 시스템 PATH 환경 변수 [1], 또는 다음 명령으로은 GraphVIZ 바이너리에 때마다 경로를 추가, 수정