繁体   English   中英

即使在PATH中添加了GraphViz文件夹,也无法访问GraphViz可执行文件

[英]Can't access GraphViz executables, even after adding GraphViz folder in PATH

我正在使用Jupyter进行图形处理,并且由于networkx无法提供良好的图形表示,我尝试使用GraphViz软件包,更具体地说是使用在那里找到的软件包: https : //github.com/chebee7i/nxpd

我首先导入了nxpd包,但是当我尝试draw()函数时,遇到了这个错误:

InvocationException:找不到GraphViz的可执行文件。

我首先以为是因为我没有安装pygraphviz软件包,这是我试图做的,但是现在我遇到了这个错误:

Collecting pygraphviz
  Using cached pygraphviz-1.3.1.zip
Building wheels for collected packages: pygraphviz
  Running setup.py bdist_wheel for pygraphviz: started
  Running setup.py bdist_wheel for pygraphviz: finished with status 'error'
  Complete output from command "D:\Program Files (x86)\Anaconda3\python.exe" -u -c "import setuptools, tokenize;__file__='C:\\Users\\VPELL_~1\\AppData\\Local\\Temp\\pip-build-vs56t5f2\\pygraphviz\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d C:\Users\VPELL_~1\AppData\Local\Temp\tmpqiovc8brpip-wheel- --python-tag cp35:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.5
  creating build\lib.win-amd64-3.5\pygraphviz
  copying pygraphviz\agraph.py -> build\lib.win-amd64-3.5\pygraphviz
  copying pygraphviz\graphviz.py -> build\lib.win-amd64-3.5\pygraphviz
  copying pygraphviz\release.py -> build\lib.win-amd64-3.5\pygraphviz
  copying pygraphviz\version.py -> build\lib.win-amd64-3.5\pygraphviz
  copying pygraphviz\__init__.py -> build\lib.win-amd64-3.5\pygraphviz
  creating build\lib.win-amd64-3.5\pygraphviz\tests
  copying pygraphviz\tests\test.py -> build\lib.win-amd64-3.5\pygraphviz\tests
  copying pygraphviz\tests\test_attributes.py -> build\lib.win-amd64-3.5\pygraphviz\tests
  copying pygraphviz\tests\test_attribute_defaults.py -> build\lib.win-amd64-3.5\pygraphviz\tests
  copying pygraphviz\tests\test_clear.py -> build\lib.win-amd64-3.5\pygraphviz\tests
  copying pygraphviz\tests\test_drawing.py -> build\lib.win-amd64-3.5\pygraphviz\tests
  copying pygraphviz\tests\test_edge_attributes.py -> build\lib.win-amd64-3.5\pygraphviz\tests
  copying pygraphviz\tests\test_graph.py -> build\lib.win-amd64-3.5\pygraphviz\tests
  copying pygraphviz\tests\test_html.py -> build\lib.win-amd64-3.5\pygraphviz\tests
  copying pygraphviz\tests\test_layout.py -> build\lib.win-amd64-3.5\pygraphviz\tests
  copying pygraphviz\tests\test_node_attributes.py -> build\lib.win-amd64-3.5\pygraphviz\tests
  copying pygraphviz\tests\test_readwrite.py -> build\lib.win-amd64-3.5\pygraphviz\tests
  copying pygraphviz\tests\test_string.py -> build\lib.win-amd64-3.5\pygraphviz\tests
  copying pygraphviz\tests\test_subgraph.py -> build\lib.win-amd64-3.5\pygraphviz\tests
  copying pygraphviz\tests\test_unicode.py -> build\lib.win-amd64-3.5\pygraphviz\tests
  copying pygraphviz\tests\__init__.py -> build\lib.win-amd64-3.5\pygraphviz\tests
  running egg_info
  writing dependency_links to pygraphviz.egg-info\dependency_links.txt
  writing top-level names to pygraphviz.egg-info\top_level.txt
  writing pygraphviz.egg-info\PKG-INFO
  warning: manifest_maker: standard file '-c' not found

  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.win-amd64-3.5\pygraphviz
  copying pygraphviz\graphviz_wrap.c -> build\lib.win-amd64-3.5\pygraphviz
  running build_ext
  building 'pygraphviz._graphviz' extension
  creating build\temp.win-amd64-3.5
  creating build\temp.win-amd64-3.5\Release
  creating build\temp.win-amd64-3.5\Release\pygraphviz
  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD "-ID:\Program Files (x86)\Anaconda3\include" "-ID:\Program Files (x86)\Anaconda3\include" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\winrt" /Tcpygraphviz/graphviz_wrap.c /Fobuild\temp.win-amd64-3.5\Release\pygraphviz/graphviz_wrap.obj
  graphviz_wrap.c
  pygraphviz/graphviz_wrap.c(2954): fatal error C1083: Cannot open include file: 'graphviz/cgraph.h': No such file or directory
  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2

  ----------------------------------------
  Running setup.py clean for pygraphviz
Failed to build pygraphviz
Installing collected packages: pygraphviz
  Running setup.py install for pygraphviz: started
    Running setup.py install for pygraphviz: finished with status 'error'
    Complete output from command "D:\Program Files (x86)\Anaconda3\python.exe" -u -c "import setuptools, tokenize;__file__='C:\\Users\\VPELL_~1\\AppData\\Local\\Temp\\pip-build-vs56t5f2\\pygraphviz\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\VPELL_~1\AppData\Local\Temp\pip-fplxc9at-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.win-amd64-3.5
    creating build\lib.win-amd64-3.5\pygraphviz
    copying pygraphviz\agraph.py -> build\lib.win-amd64-3.5\pygraphviz
    copying pygraphviz\graphviz.py -> build\lib.win-amd64-3.5\pygraphviz
    copying pygraphviz\release.py -> build\lib.win-amd64-3.5\pygraphviz
    copying pygraphviz\version.py -> build\lib.win-amd64-3.5\pygraphviz
    copying pygraphviz\__init__.py -> build\lib.win-amd64-3.5\pygraphviz
    creating build\lib.win-amd64-3.5\pygraphviz\tests
    copying pygraphviz\tests\test.py -> build\lib.win-amd64-3.5\pygraphviz\tests
    copying pygraphviz\tests\test_attributes.py -> build\lib.win-amd64-3.5\pygraphviz\tests
    copying pygraphviz\tests\test_attribute_defaults.py -> build\lib.win-amd64-3.5\pygraphviz\tests
    copying pygraphviz\tests\test_clear.py -> build\lib.win-amd64-3.5\pygraphviz\tests
    copying pygraphviz\tests\test_drawing.py -> build\lib.win-amd64-3.5\pygraphviz\tests
    copying pygraphviz\tests\test_edge_attributes.py -> build\lib.win-amd64-3.5\pygraphviz\tests
    copying pygraphviz\tests\test_graph.py -> build\lib.win-amd64-3.5\pygraphviz\tests
    copying pygraphviz\tests\test_html.py -> build\lib.win-amd64-3.5\pygraphviz\tests
    copying pygraphviz\tests\test_layout.py -> build\lib.win-amd64-3.5\pygraphviz\tests
    copying pygraphviz\tests\test_node_attributes.py -> build\lib.win-amd64-3.5\pygraphviz\tests
    copying pygraphviz\tests\test_readwrite.py -> build\lib.win-amd64-3.5\pygraphviz\tests
    copying pygraphviz\tests\test_string.py -> build\lib.win-amd64-3.5\pygraphviz\tests
    copying pygraphviz\tests\test_subgraph.py -> build\lib.win-amd64-3.5\pygraphviz\tests
    copying pygraphviz\tests\test_unicode.py -> build\lib.win-amd64-3.5\pygraphviz\tests
    copying pygraphviz\tests\__init__.py -> build\lib.win-amd64-3.5\pygraphviz\tests
    running egg_info
    writing dependency_links to pygraphviz.egg-info\dependency_links.txt
    writing pygraphviz.egg-info\PKG-INFO
    writing top-level names to pygraphviz.egg-info\top_level.txt
    warning: manifest_maker: standard file '-c' not found

    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.win-amd64-3.5\pygraphviz
    copying pygraphviz\graphviz_wrap.c -> build\lib.win-amd64-3.5\pygraphviz
    running build_ext
    building 'pygraphviz._graphviz' extension
    creating build\temp.win-amd64-3.5
    creating build\temp.win-amd64-3.5\Release
    creating build\temp.win-amd64-3.5\Release\pygraphviz
    C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -INone "-ID:\Program Files (x86)\Anaconda3\include" "-ID:\Program Files (x86)\Anaconda3\include" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\winrt" /Tcpygraphviz/graphviz_wrap.c /Fobuild\temp.win-amd64-3.5\Release\pygraphviz/graphviz_wrap.obj
    graphviz_wrap.c
    pygraphviz/graphviz_wrap.c(2954): fatal error C1083: Cannot open include file: 'graphviz/cgraph.h': No such file or directory
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2

    ----------------------------------------
  Failed building wheel for pygraphviz
Command ""D:\Program Files (x86)\Anaconda3\python.exe" -u -c "import setuptools, tokenize;__file__='C:\\Users\\VPELL_~1\\AppData\\Local\\Temp\\pip-build-vs56t5f2\\pygraphviz\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\VPELL_~1\AppData\Local\Temp\pip-fplxc9at-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\VPELL_~1\AppData\Local\Temp\pip-build-vs56t5f2\pygraphviz\
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

在StackOverflow上搜索之后,我添加了以下目录:

D:\Program Files (x86)\Anaconda3\Lib\site-packages\graphviz\bin
D:\Program Files (x86)\Anaconda3\Lib\site-packages\graphviz\include\graphviz

到我的路径,但没有任何改变。

谢谢您的帮助。

您是否使用以下命令在命令提示符中添加了路径?

PATH = %PATH%;<new path stuff>

还是使用“系统属性”中的环境变量添加了它?

我发现我需要使用系统属性来添加它,以使其在整个系统范围内起作用。 仅使用命令提示符添加时,它仍然不起作用。

尝试使用os.environ在jupyter笔记本本身中添加路径。

import os
os.environ["PATH"] += os.pathsep + 'C:/Program Files (x86)/Graphviz2.38/bin/'

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM