在MacBook Pro OS Sierra上安装graphviz时出错

时间:2019-04-10 20:55:22

标签: python-2.7 pygraphviz

我正在尝试使用pip安装pygraphviz,但出现此错误:

j > i

请帮助,我确实安装了graphviz:

Collecting pygraphviz
  Using cached https://files.pythonhosted.org/packages/7e/b1/d6d849ddaf6f11036f9980d433f383d4c13d1ebcfc3cd09bc845bda7e433/pygraphviz-1.5.zip
Installing collected packages: pygraphviz
  Running setup.py install for pygraphviz
    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
    Trying dpkg
    Failed to find dpkg
    Trying pkg-config
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/43/m1qv9zf53q19sqh6h9kg9pz80000gn/T/pip-build-2nqbhW/pygraphviz/setup.py", line 93, in <module>
        tests_require=['nose>=1.3.7', 'doctest-ignore-unicode>=0.1.2', 'mock>=2.0.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 162, in get_graphviz_dirs
        include_dirs, library_dirs = _try_configure(include_dirs, library_dirs, _pkg_config)
      File "setup_extra.py", line 117, in _try_configure
        i, l = try_function()
      File "setup_extra.py", line 72, 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
    Complete output from command /Users/ciasto/virtualPyEnvs/netgraph/bin/python -c "import setuptools, tokenize;__file__='/private/var/folders/43/m1qv9zf53q19sqh6h9kg9pz80000gn/T/pip-build-2nqbhW/pygraphviz/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/43/m1qv9zf53q19sqh6h9kg9pz80000gn/T/pip-D9iNeZ-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/ciasto/virtualPyEnvs/netgraph/include/site/python2.7:
    running install

    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

    Trying dpkg

    Failed to find dpkg

    Trying pkg-config

    Traceback (most recent call last):

      File "<string>", line 1, in <module>

      File "/private/var/folders/43/m1qv9zf53q19sqh6h9kg9pz80000gn/T/pip-build-2nqbhW/pygraphviz/setup.py", line 93, in <module>

        tests_require=['nose>=1.3.7', 'doctest-ignore-unicode>=0.1.2', 'mock>=2.0.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 162, in get_graphviz_dirs

        include_dirs, library_dirs = _try_configure(include_dirs, library_dirs, _pkg_config)

      File "setup_extra.py", line 117, in _try_configure

        i, l = try_function()

      File "setup_extra.py", line 72, 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 "/Users/ciasto/virtualPyEnvs/netgraph/bin/python -c "import setuptools, tokenize;__file__='/private/var/folders/43/m1qv9zf53q19sqh6h9kg9pz80000gn/T/pip-build-2nqbhW/pygraphviz/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/43/m1qv9zf53q19sqh6h9kg9pz80000gn/T/pip-D9iNeZ-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/ciasto/virtualPyEnvs/netgraph/include/site/python2.7" failed with error code 1 in /private/var/folders/43/m1qv9zf53q19sqh6h9kg9pz80000gn/T/pip-build-2nqbhW/pygraphviz

1 个答案:

答案 0 :(得分:0)

在pygraphviz之前需要安装一些依赖项。好吧,实际上是根据documentation

brew install graphviz