无法安装 pygraphviz

2024-04-17

我在 macOS Mojave 10.14.1 上安装 pygraphviz 时遇到问题。我使用的Python版本是3.6.7。 执行命令时pip install pygraphviz,我收到以下冗长的错误消息:

Collecting pygraphviz
Using cached https://files.pythonhosted.org/packages/7e/b1/d6d849ddaf6f11036f9980d433f383d4c13d1ebcfc3cd09bc845bda7e433/pygraphviz-1.5.zip
Building wheels for collected packages: pygraphviz
Running setup.py bdist_wheel for pygraphviz ... error
Complete output from command /Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/rn/zr6qnswn7wb886b6twbfgjym0000gn/T/pip-install-x_fr0oej/pygraphviz/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /private/var/folders/rn/zr6qnswn7wb886b6twbfgjym0000gn/T/pip-wheel-qre51z9v --python-tag cp36:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-3.6
creating build/lib.macosx-10.9-x86_64-3.6/pygraphviz
copying pygraphviz/release.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz
copying pygraphviz/version.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz
copying pygraphviz/graphviz.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz
copying pygraphviz/__init__.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz
copying pygraphviz/agraph.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz
creating build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_setup.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_unicode.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_readwrite.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_string.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/__init__.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_html.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_node_attributes.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_drawing.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_subgraph.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_edge_attributes.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_clear.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_layout.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_attribute_defaults.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_graph.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_attributes.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
running egg_info
writing pygraphviz.egg-info/PKG-INFO
writing dependency_links to pygraphviz.egg-info/dependency_links.txt
writing top-level names to pygraphviz.egg-info/top_level.txt
reading manifest file 'pygraphviz.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*.png' under directory 'doc'
warning: no files found matching '*.html' under directory 'doc'
warning: no files found matching '*.txt' under directory 'doc'
warning: no files found matching '*.css' under directory 'doc'
warning: no previously-included files matching '*~' found anywhere in distribution
warning: no previously-included files matching '*.pyc' found anywhere in distribution
warning: no previously-included files matching '.svn' found anywhere in distribution
no previously-included directories found matching 'doc/build'
writing manifest file 'pygraphviz.egg-info/SOURCES.txt'
copying pygraphviz/graphviz.i -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz
copying pygraphviz/graphviz_wrap.c -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz
running build_ext
building 'pygraphviz._graphviz' extension
creating build/temp.macosx-10.9-x86_64-3.6
creating build/temp.macosx-10.9-x86_64-3.6/pygraphviz
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c pygraphviz/graphviz_wrap.c -o build/temp.macosx-10.9-x86_64-3.6/pygraphviz/graphviz_wrap.o
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
error: command 'gcc' failed with exit status 1

----------------------------------------
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 /Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/rn/zr6qnswn7wb886b6twbfgjym0000gn/T/pip-install-x_fr0oej/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 /private/var/folders/rn/zr6qnswn7wb886b6twbfgjym0000gn/T/pip-record-kukz1ofd/install-record.txt --single-version-externally-managed --compile:
running install
Trying dpkg
Failed to find dpkg
Trying pkg-config
Failed to find pkg-config
Trying dotneato-config
Failed to find dotneato-config
Failed to find dotneato-config

Your Graphviz installation could not be found.

        1) You don't have Graphviz installed:
           Install Graphviz (http://graphviz.org)

        2) Your Graphviz package might incomplete.
           Install the binary development subpackage (e.g. libgraphviz-dev or similar.)

        3) You are using Windows
           There are no PyGraphviz binary packages for Windows but you might be
           able to build it from this source.  See
           http://networkx.lanl.gov/pygraphviz/reference/faq.html

        If you think your installation is correct you will need to manually
        provide path to graphviz include and library. For example:

        pip install pygraphviz --install-option="--include-path=/usr/include/graphviz" --install-option="--library-path=/usr/lib/graphviz/"

        The current setting of library_dirs and include_dirs is:
library_dirs=None
include_dirs=None

error: Error locating graphviz.

----------------------------------------
Command "/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/rn/zr6qnswn7wb886b6twbfgjym0000gn/T/pip-install-x_fr0oej/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 /private/var/folders/rn/zr6qnswn7wb886b6twbfgjym0000gn/T/pip-record-kukz1ofd/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/rn/zr6qnswn7wb886b6twbfgjym0000gn/T/pip-install-x_fr0oej/pygraphviz/

有人可以帮我吗?谢谢!

I applied the suggestion of @hoefling: xcode-select --install, and then try pip3 install pygraphviz. An error is still existing like the following pictures: enter image description here


该问题已通过使用以下命令完成:

pip install pygraphviz --install-option="--include-path=/usr/include/graphviz" --install-option="--library-path=/usr/lib/graphviz/"
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

无法安装 pygraphviz 的相关文章

随机推荐