PIP安装pygraphviz:不包 'libcgraph' 发现

问题描述:

我成功地安装graphvizcgraphPIP安装pygraphviz:不包 'libcgraph' 发现

$ sudo pip install graphviz 
.... 
Successfully installed graphviz-0.5.1 

$ sudo pip install cgraph 
... 
Successfully installed cgraph-0.1 

我遇到问题No package 'libcgraph' found在运行sudo pip install pygraphviz。以下是完整的堆栈跟踪。

$ sudo pip install pygraphviz 
The directory '/Users/sparkandshine/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. 
The directory '/Users/sparkandshine/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. 
Collecting pygraphviz 
    Downloading pygraphviz-1.3.1.zip (123kB) 
    100% |████████████████████████████████| 133kB 1.5MB/s 
Installing collected packages: pygraphviz 
    Running setup.py install for pygraphviz ... error 
    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-qfFpFG/pygraphviz/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-JmwjA6-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 "/private/tmp/pip-build-qfFpFG/pygraphviz/setup.py", line 87, in <module> 
     tests_require=['nose>=0.10.1', 'doctest-ignore-unicode>=0.1.0',], 
     File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 151, in setup 
     dist.run_commands() 
     File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands 
     self.run_command(cmd) 
     File "/System/Library/Frameworks/Python.framework/Versions/2.7/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 "/System/Library/Frameworks/Python.framework/Versions/2.7/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 "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-qfFpFG/pygraphviz/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-JmwjA6-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-build-qfFpFG/pygraphviz/ 

我试图通过Python does not see pygraphviz提供的解决方案,但它不工作。

+0

什么操作系统你在吗? –

+0

@MosesKoledoye,塞拉利昂的MacOS版本10.12 – SparkAndShine

+0

尝试'冲泡安装的graphviz-devel'和'冲泡安装PKG-config' –

sudo apt-get install python-dev graphviz libgraphviz-dev pkg-config 

然后

sudo pip install pygraphviz 
+0

我发现我需要先做'sudo易于得到安装python-dev',否则我会得到一个在执行'pip install pygraphviz'时编译有关缺少'Python.h'的错误。 –

+0

我更新了python-dev的要求,以防有人遇到类似的问题。谢谢。 –

在MacOS,我,使它

$ brew install graphviz 
$ sudo pip install pygraphviz 

Fedora用户:

  1. 百胜名单可graphviz*
  2. 选择适当的包为您的Fedora发行
  3. sudo yum install 'graphviz-devel.x86_64'
  4. pip install pygraphviz

为CentOS。 由于需要graphviz-devel来解决此问题,因此您需要使用yum进行安装。要做到这一点,你需要添加回购的地方包可用。在我的情况下,Atomic回购工作正常。

wget -q -O - http://www.atomicorp.com/installers/atomic | sh 

这将增加原子回购,然后

sudo yum install graphviz-devel 

,你应该能够执行

pip install pygraphviz 

适用于MacOS,我需要做的:

$ brew install graphviz 
$ sudo pip install pygraphviz --install-option="--include-path=/usr/local/include" --install-option="--library-path=/usr/local/lib" 
+3

我使用的virtualenv和Python 3,我能做到'PIP安装graphviz'无需任何额外的选项和它(安装graphviz'冲泡后')工作的罚款。 – Trenton

+0

Oh maann .. Thankx很多..这对我来说非常合适。你救了我的一天,我的屁股被踢开了。 :)每@ – Jyotirmay

+0

作为特伦顿的说明 - 我发现满足所有要求我跑后'冲泡安装graphviz'注意冲泡安装暂停对字体的东西很长一段时间'PIP安装graphviz'。 – Rob