앞의 게시물에 이어 윈도우 환경에서 pygraphviz를 설치하는 방법에 대해 알아보도록 하겠습니다.
conda가 아닌 일반 가상환경에서 설치할 때는 좀 더 방법이 까다롭습니다.
저는 virtualenv 가상환경에서 설치를 진행했고, 몇 번의 에러를 마주하고 나서야 겨우 설치에 성공할 수 있었습니다.
순서는 다음과 같습니다.
(1) cmd에서 graphviz 설치하기
(2) cmd에서 pygraphviz 설치하기
생각보다 매우 간단합니다.
1. cmd에서 graphviz 설치하기
먼저 cmd에서 pip를 통해 graphviz를 설치해줍니다.
pip install graphviz # graphviz 설치
2. cmd에서 pygraphviz 설치하기
graphviz 설치가 완료되면, pygraphviz를 설치해줍니다. 단, 이 때 그냥 손이 가는대로 pip install pygraphviz나 pip install python-graphviz를 입력하면 안 됩니다.
ERROR: Could not find a version that satisfies the requirement python-graphviz
ERROR: No matching distribution found for python-graphviz
pip install pygraphviz를 쳤을 때 위와 같은 에러가 발생한다면, 아래처럼 입력하면 됩니다.
# pip install --global-option=build_ext --global-option="-I'graphviz의 include 경로'" --global-option="-L'graphviz의 lib 경로" pygraphviz
pip install --global-option=build_ext --global-option="-IC:\Program Files\Graphviz\include" --global-option="-LC:\Program Files\Graphviz\lib" pygraphviz
위와 같이 입력해주면, 설치가 성공적으로 진행된 것을 확인할 수 있습니다.
3. 발생했던 다른 에러
graphviz/graphviz_wrap.c(2711): fatal error C1083: 포함 파일을 열 수 없습니다. 'graphviz/cgraph.h' : No such file or directory
2의 방법으로 해결하였습니다. 다만 왜 이 에러가 발생하는지는 확실히 파악하지 못했기 때문에, 좀 더 공부해보고 다른 게시물로 업로드하려고 합니다.
※ 참고 자료
pygraphviz.github.io/documentation/stable/install.html
Install — PyGraphviz 1.7 documentation
Providing path to Graphviz If you’ve installed Graphviz and pip is unable to find Graphviz, then you need to provide pip with the path(s) where it can find Graphviz. To do this, you first need to figure out where the binary files, includes files, and lib
pygraphviz.github.io
github.com/pygraphviz/pygraphviz/issues/40
Installation:fatal error: 'graphviz/cgraph.h' file not found · Issue #40 · pygraphviz/pygraphviz
I use Windoews 7 OS and python 3.4.2 I run the code: python setup.py install But it cause the error: D:\pygraphviz-master>python setup.py install library_dirs=None include_dirs=None running inst...
github.com
'Python' 카테고리의 다른 글
[error] pytube 다운로드 에러: AttributeError: 'NoneType' object has no attribute 'span' (0) | 2021.11.23 |
---|---|
[Python] 한 방에 알파벳 리스트 만들기 (0) | 2021.06.20 |
[python]Windows 10에 pygraphviz 설치하기(conda) (0) | 2021.04.25 |
[Python]virtualenv의 파이썬 버전 변경하기 (0) | 2021.03.27 |
[Python] kernel에 설치된 라이브러리 조회 및 버전 확인하기 (0) | 2020.10.08 |