2016-07-21 2 views
1

, 난 따라서 pygraphiviz-1.3.1.tar.gzpip install pygraphviz를 다운로드 오류python에서 네트워크를 시각화하는 데 실패 - pygraphviz와 함께 문제가 있습니까? 내가 네트워크를 시각화하는 몇 가지 코드를 사용할 때

Traceback (most recent call last): 
File "networkplot.py", line 21, in <module> 
pos = graphviz_layout(G, prog='neato') 
File "/opt/conda/lib/python2.7/site-packages/networkx/drawing/nx_agraph.py", line 228, in graphviz_layout 
return pygraphviz_layout(G,prog=prog,root=root,args=args) 
File "/opt/conda/lib/python2.7/site-packages/networkx/drawing/nx_agraph.py", line 258, in pygraphviz_layout 
'http://pygraphviz.github.io/') 
ImportError: ('requires pygraphviz ', 'http://pygraphviz.github.io/') 

가 발생했습니다.

import networkx as nx 
import matplotlib.pyplot as plt 
plt.switch_backend('agg') 
from networkx.drawing.nx_agraph import graphviz_layout 
import graphs 

A = graphs.create_graph() 
graph = A.graph 
G, labels = A.networkList() 

fig = plt.figure() 
pos = graphviz_layout(G, prog='neato') 

이 사람이 나에게이 문제를 해결하는 방법을 알려 수 없습니다 : 그것은

Failed building wheel for pygraphviz 
Running setup.py clean for pygraphviz 
Failed to build pygraphviz 
Installing collected packages: pygraphviz 
Running setup.py install for pygraphviz ... error 
Complete output from command /opt/conda/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-0RJB9q/pygraphviz/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-vo59d4-record/install-record.txt --single-version-externally-managed --compile: 
running install 
Trying pkg-config 
Package libcgraph was not found in the pkg-config search path. 
Perhaps you should add the directory containing `libcgraph.pc' 
to the PKG_CONFIG_PATH environment variable 
No package 'libcgraph' found 
Traceback (most recent call last): 
    File "<string>", line 1, in <module> 
    File "/tmp/pip-build-0RJB9q/pygraphviz/setup.py", line 87, in <module> 
    tests_require=['nose>=0.10.1', 'doctest-ignore-unicode>=0.1.0',], 
    File "/opt/conda/lib/python2.7/distutils/core.py", line 151, in setup 
    dist.run_commands() 
    File "/opt/conda/lib/python2.7/distutils/dist.py", line 953, in run_commands 
    self.run_command(cmd) 
    File "/opt/conda/lib/python2.7/distutils/dist.py", line 972, in run_command 
    cmd_obj.run() 
    File "setup_commands.py", line 44, in modified_run 
    self.include_path, self.library_path = get_graphviz_dirs() 
    File "setup_extra.py", line 121, in get_graphviz_dirs 
    include_dirs, library_dirs = _pkg_config() 
    File "setup_extra.py", line 44, in _pkg_config 
    output = S.check_output(['pkg-config', '--libs-only-L', 'libcgraph']) 
    File "/opt/conda/lib/python2.7/subprocess.py", line 573, in check_output 
    raise CalledProcessError(retcode, cmd, output=output) 
subprocess.CalledProcessError: Command '['pkg-config', '--libs-only-L', 'libcgraph']' returned non-zero exit status 1 

---------------------------------------- 
Command "/opt/conda/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-0RJB9q/pygraphviz/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-vo59d4-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-0RJB9q/pygraphviz/ 

내가 사용하는 코드

을 보여 주었다? 도와 주셔서 감사합니다. 고마워요!

+0

그래,'import graphviz'를 추가했는데 여전히'ImportError :('pygraphviz', 'http://pygraphviz.github.io/'가 필요합니다)' – achimneyswallow

답변

1

libcgraphhttp://graphviz.org/에서 graphviz 패키지의 일부입니다. pygraphviz을 설치하기 전에 설치해야합니다. pip와 함께 설치할 graphviz 패키지는 Python 패키지이며 필요한 graphviz 패키지는 아닙니다.

+0

libcgraph가 들어있는 디렉토리를 추가하려고 시도한 적이 있습니까? PKG_CONFIG_PATH 환경 변수가 필요합니까? – manan

관련 문제