pygraphviz 的构建轮失败

Failed building wheel for pygraphviz

我在使用 pip 为 Windows 安装 pygraphviz 时遇到了问题。 Python 2.7 工作正常,我使用 pip 完成了其他安装,没有出现错误。我已经安装了 graphviz。

当执行 pip install pygraphviz 时,我得到以下输出:

Collecting pygraphviz
  Using cached pygraphviz-1.3.1.zip
Building wheels for collected packages: pygraphviz
  Running setup.py bdist_wheel for pygraphviz ... error
  Complete output from command c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\users\cnh004\appdata\local\temp\pip-build-onw9wy\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 c:\users\cnh004\appdata\local\temp\tmpcdsmtypip-wheel- --python-tag cp27:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win32-2.7
  creating build\lib.win32-2.7\pygraphviz
  copying pygraphviz\agraph.py -> build\lib.win32-2.7\pygraphviz
  copying pygraphviz\graphviz.py -> build\lib.win32-2.7\pygraphviz
  copying pygraphviz\release.py -> build\lib.win32-2.7\pygraphviz
  copying pygraphviz\version.py -> build\lib.win32-2.7\pygraphviz
  copying pygraphviz\__init__.py -> build\lib.win32-2.7\pygraphviz
  creating build\lib.win32-2.7\pygraphviz\tests
  copying pygraphviz\tests\test.py -> build\lib.win32-2.7\pygraphviz\tests
  copying pygraphviz\tests\test_attributes.py -> build\lib.win32-2.7\pygraphviz\tests
  copying pygraphviz\tests\test_attribute_defaults.py -> build\lib.win32-2.7\pygraphviz\tests
  copying pygraphviz\tests\test_clear.py -> build\lib.win32-2.7\pygraphviz\tests
  copying pygraphviz\tests\test_drawing.py -> build\lib.win32-2.7\pygraphviz\tests
  copying pygraphviz\tests\test_edge_attributes.py -> build\lib.win32-2.7\pygraphviz\tests
  copying pygraphviz\tests\test_graph.py -> build\lib.win32-2.7\pygraphviz\tests
  copying pygraphviz\tests\test_html.py -> build\lib.win32-2.7\pygraphviz\tests
  copying pygraphviz\tests\test_layout.py -> build\lib.win32-2.7\pygraphviz\tests
  copying pygraphviz\tests\test_node_attributes.py -> build\lib.win32-2.7\pygraphviz\tests
  copying pygraphviz\tests\test_readwrite.py -> build\lib.win32-2.7\pygraphviz\tests
  copying pygraphviz\tests\test_string.py -> build\lib.win32-2.7\pygraphviz\tests
  copying pygraphviz\tests\test_subgraph.py -> build\lib.win32-2.7\pygraphviz\tests
  copying pygraphviz\tests\test_unicode.py -> build\lib.win32-2.7\pygraphviz\tests
  copying pygraphviz\tests\__init__.py -> build\lib.win32-2.7\pygraphviz\tests
  running egg_info
  writing pygraphviz.egg-info\PKG-INFO
  writing top-level names to pygraphviz.egg-info\top_level.txt
  writing dependency_links to pygraphviz.egg-info\dependency_links.txt
  reading manifest file 'pygraphviz.egg-info\SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  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.win32-2.7\pygraphviz
  copying pygraphviz\graphviz_wrap.c -> build\lib.win32-2.7\pygraphviz
  running build_ext
  building 'pygraphviz._graphviz' extension
  error: Microsoft Visual C++ 9.0 is required. Get it from http://aka.ms/vcpython27

  ----------------------------------------
  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 c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\users\cnh004\appdata\local\temp\pip-build-onw9wy\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 c:\users\cnh004\appdata\local\temp\pip-wa7pph-record\install-record.txt --single-version-externally-managed --compile:
    running install
    include_dirs=None
    library_dirs=None
    running build
    running build_py
    creating build
    creating build\lib.win32-2.7
    creating build\lib.win32-2.7\pygraphviz
    copying pygraphviz\agraph.py -> build\lib.win32-2.7\pygraphviz
    copying pygraphviz\graphviz.py -> build\lib.win32-2.7\pygraphviz
    copying pygraphviz\release.py -> build\lib.win32-2.7\pygraphviz
    copying pygraphviz\version.py -> build\lib.win32-2.7\pygraphviz
    copying pygraphviz\__init__.py -> build\lib.win32-2.7\pygraphviz
    creating build\lib.win32-2.7\pygraphviz\tests
    copying pygraphviz\tests\test.py -> build\lib.win32-2.7\pygraphviz\tests
    copying pygraphviz\tests\test_attributes.py -> build\lib.win32-2.7\pygraphviz\tests
    copying pygraphviz\tests\test_attribute_defaults.py -> build\lib.win32-2.7\pygraphviz\tests
    copying pygraphviz\tests\test_clear.py -> build\lib.win32-2.7\pygraphviz\tests
    copying pygraphviz\tests\test_drawing.py -> build\lib.win32-2.7\pygraphviz\tests
    copying pygraphviz\tests\test_edge_attributes.py -> build\lib.win32-2.7\pygraphviz\tests
    copying pygraphviz\tests\test_graph.py -> build\lib.win32-2.7\pygraphviz\tests
    copying pygraphviz\tests\test_html.py -> build\lib.win32-2.7\pygraphviz\tests
    copying pygraphviz\tests\test_layout.py -> build\lib.win32-2.7\pygraphviz\tests
    copying pygraphviz\tests\test_node_attributes.py -> build\lib.win32-2.7\pygraphviz\tests
    copying pygraphviz\tests\test_readwrite.py -> build\lib.win32-2.7\pygraphviz\tests
    copying pygraphviz\tests\test_string.py -> build\lib.win32-2.7\pygraphviz\tests
    copying pygraphviz\tests\test_subgraph.py -> build\lib.win32-2.7\pygraphviz\tests
    copying pygraphviz\tests\test_unicode.py -> build\lib.win32-2.7\pygraphviz\tests
    copying pygraphviz\tests\__init__.py -> build\lib.win32-2.7\pygraphviz\tests
    running egg_info
    writing pygraphviz.egg-info\PKG-INFO
    writing top-level names to pygraphviz.egg-info\top_level.txt
    writing dependency_links to pygraphviz.egg-info\dependency_links.txt
    reading manifest file 'pygraphviz.egg-info\SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    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.win32-2.7\pygraphviz
    copying pygraphviz\graphviz_wrap.c -> build\lib.win32-2.7\pygraphviz
    running build_ext
    building 'pygraphviz._graphviz' extension
    error: Microsoft Visual C++ 9.0 is required. Get it from http://aka.ms/vcpython27

    ----------------------------------------
Command "c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\users\cnh004\appdata\local\temp\pip-build-onw9wy\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 c:\users\cnh004\appdata\local\temp\pip-wa7pph-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\cnh004\appdata\local\temp\pip-build-onw9wy\pygraphviz\

我也查看了 ,但是当我尝试按照建议安装 cgraph 时,它再次显示 Failed building wheel for cgraph。如果有人有任何建议,我们将不胜感激。谢谢。

Microsoft Visual C++ 9.0 is required. Get it from http://aka.ms/vcpython27

完全不言自明的解释,甚至包括解决方案。另见 https://wiki.python.org/moin/WindowsCompilers and