首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >pip install pygraphviz:找不到包'libcgraph‘

pip install pygraphviz:找不到包'libcgraph‘
EN

Stack Overflow用户
提问于 2016-11-10 20:49:01
回答 5查看 27.7K关注 0票数 71

我使用成功地安装了graphvizcgraph

代码语言:javascript
复制
$ sudo pip install graphviz
....
Successfully installed graphviz-0.5.1

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

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

代码语言:javascript
复制
$ 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提供的解决方案,但它不起作用。

EN

回答 5

Stack Overflow用户

回答已采纳

发布于 2017-02-18 21:19:06

代码语言:javascript
复制
sudo apt-get install python-dev graphviz libgraphviz-dev pkg-config

或者,如果您使用的是Python 3,则可能需要以下内容:

代码语言:javascript
复制
sudo apt-get install python3-dev graphviz libgraphviz-dev pkg-config

然后

代码语言:javascript
复制
pip install pygraphviz
票数 118
EN

Stack Overflow用户

发布于 2017-05-27 03:11:20

对于MacOS,我需要做的是:

代码语言:javascript
复制
$ brew install graphviz
$ sudo pip install pygraphviz 
票数 46
EN

Stack Overflow用户

发布于 2016-11-10 21:21:31

在macOS上,我用

代码语言:javascript
复制
$ brew install graphviz
$ sudo pip install pygraphviz
票数 6
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40528048

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档