首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Windows 10中安装pygraphviz -缺少basetsd.h

在Windows 10中安装pygraphviz -缺少basetsd.h
EN

Stack Overflow用户
提问于 2020-05-28 04:09:27
回答 2查看 2K关注 0票数 0

我在运行Python3.7的Windows 10 X64上安装pygraphviz时遇到了困难。我使用: pip安装graphviz来安装graphviz,就像这里建议的那样:Pip安装pygraphviz失败: pygraphviz的建筑车轮失效。我不知道需要做些什么才能让pygraphviz运行。任何帮助都将不胜感激。提前感谢。

运行pygraphviz时,会遇到以下错误:

代码语言:javascript
复制
Microsoft Windows [Version 10.0.18362.836]
(c) 2019 Microsoft Corporation. All rights reserved.

C:\Users\prash>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
  Building wheel for pygraphviz (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'C:\Users\prash\Anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\prash\\AppData\\Local\\Temp\\pip-install-pa571k38\\pygraphviz\\setup.py'"'"'; __file__='"'"'C:\\Users\\prash\\AppData\\Local\\Temp\\pip-install-pa571k38\\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\prash\AppData\Local\Temp\pip-wheel-zkrlosp9' --python-tag cp37
       cwd: C:\Users\prash\AppData\Local\Temp\pip-install-pa571k38\pygraphviz\
  Complete output (54 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.7
  creating build\lib.win-amd64-3.7\pygraphviz
  copying pygraphviz\agraph.py -> build\lib.win-amd64-3.7\pygraphviz
  copying pygraphviz\graphviz.py -> build\lib.win-amd64-3.7\pygraphviz
  copying pygraphviz\release.py -> build\lib.win-amd64-3.7\pygraphviz
  copying pygraphviz\version.py -> build\lib.win-amd64-3.7\pygraphviz
  copying pygraphviz\__init__.py -> build\lib.win-amd64-3.7\pygraphviz
  creating build\lib.win-amd64-3.7\pygraphviz\tests
  copying pygraphviz\tests\test.py -> build\lib.win-amd64-3.7\pygraphviz\tests
  copying pygraphviz\tests\test_attributes.py -> build\lib.win-amd64-3.7\pygraphviz\tests
  copying pygraphviz\tests\test_attribute_defaults.py -> build\lib.win-amd64-3.7\pygraphviz\tests
  copying pygraphviz\tests\test_clear.py -> build\lib.win-amd64-3.7\pygraphviz\tests
  copying pygraphviz\tests\test_drawing.py -> build\lib.win-amd64-3.7\pygraphviz\tests
  copying pygraphviz\tests\test_edge_attributes.py -> build\lib.win-amd64-3.7\pygraphviz\tests
  copying pygraphviz\tests\test_graph.py -> build\lib.win-amd64-3.7\pygraphviz\tests
  copying pygraphviz\tests\test_html.py -> build\lib.win-amd64-3.7\pygraphviz\tests
  copying pygraphviz\tests\test_layout.py -> build\lib.win-amd64-3.7\pygraphviz\tests
  copying pygraphviz\tests\test_node_attributes.py -> build\lib.win-amd64-3.7\pygraphviz\tests
  copying pygraphviz\tests\test_readwrite.py -> build\lib.win-amd64-3.7\pygraphviz\tests
  copying pygraphviz\tests\test_setup.py -> build\lib.win-amd64-3.7\pygraphviz\tests
  copying pygraphviz\tests\test_string.py -> build\lib.win-amd64-3.7\pygraphviz\tests
  copying pygraphviz\tests\test_subgraph.py -> build\lib.win-amd64-3.7\pygraphviz\tests
  copying pygraphviz\tests\test_unicode.py -> build\lib.win-amd64-3.7\pygraphviz\tests
  copying pygraphviz\tests\__init__.py -> build\lib.win-amd64-3.7\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.win-amd64-3.7\pygraphviz
  copying pygraphviz\graphviz_wrap.c -> build\lib.win-amd64-3.7\pygraphviz
  running build_ext
  building 'pygraphviz._graphviz' extension
  creating build\temp.win-amd64-3.7
  creating build\temp.win-amd64-3.7\Release
  creating build\temp.win-amd64-3.7\Release\pygraphviz
  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\prash\Anaconda3\include -IC:\Users\prash\Anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" /Tcpygraphviz/graphviz_wrap.c /Fobuild\temp.win-amd64-3.7\Release\pygraphviz/graphviz_wrap.obj
  graphviz_wrap.c
  c:\users\prash\anaconda3\include\pyconfig.h(203): fatal error C1083: Cannot open include file: 'basetsd.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
  ----------------------------------------
  ERROR: 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
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\prash\Anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\prash\\AppData\\Local\\Temp\\pip-install-pa571k38\\pygraphviz\\setup.py'"'"'; __file__='"'"'C:\\Users\\prash\\AppData\\Local\\Temp\\pip-install-pa571k38\\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\prash\AppData\Local\Temp\pip-record-pvkn27t1\install-record.txt' --single-version-externally-managed --compile
         cwd: C:\Users\prash\AppData\Local\Temp\pip-install-pa571k38\pygraphviz\
    Complete output (56 lines):
    running install
    include_dirs=None
    library_dirs=None
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.7
    creating build\lib.win-amd64-3.7\pygraphviz
    copying pygraphviz\agraph.py -> build\lib.win-amd64-3.7\pygraphviz
    copying pygraphviz\graphviz.py -> build\lib.win-amd64-3.7\pygraphviz
    copying pygraphviz\release.py -> build\lib.win-amd64-3.7\pygraphviz
    copying pygraphviz\version.py -> build\lib.win-amd64-3.7\pygraphviz
    copying pygraphviz\__init__.py -> build\lib.win-amd64-3.7\pygraphviz
    creating build\lib.win-amd64-3.7\pygraphviz\tests
    copying pygraphviz\tests\test.py -> build\lib.win-amd64-3.7\pygraphviz\tests
    copying pygraphviz\tests\test_attributes.py -> build\lib.win-amd64-3.7\pygraphviz\tests
    copying pygraphviz\tests\test_attribute_defaults.py -> build\lib.win-amd64-3.7\pygraphviz\tests
    copying pygraphviz\tests\test_clear.py -> build\lib.win-amd64-3.7\pygraphviz\tests
    copying pygraphviz\tests\test_drawing.py -> build\lib.win-amd64-3.7\pygraphviz\tests
    copying pygraphviz\tests\test_edge_attributes.py -> build\lib.win-amd64-3.7\pygraphviz\tests
    copying pygraphviz\tests\test_graph.py -> build\lib.win-amd64-3.7\pygraphviz\tests
    copying pygraphviz\tests\test_html.py -> build\lib.win-amd64-3.7\pygraphviz\tests
    copying pygraphviz\tests\test_layout.py -> build\lib.win-amd64-3.7\pygraphviz\tests
    copying pygraphviz\tests\test_node_attributes.py -> build\lib.win-amd64-3.7\pygraphviz\tests
    copying pygraphviz\tests\test_readwrite.py -> build\lib.win-amd64-3.7\pygraphviz\tests
    copying pygraphviz\tests\test_setup.py -> build\lib.win-amd64-3.7\pygraphviz\tests
    copying pygraphviz\tests\test_string.py -> build\lib.win-amd64-3.7\pygraphviz\tests
    copying pygraphviz\tests\test_subgraph.py -> build\lib.win-amd64-3.7\pygraphviz\tests
    copying pygraphviz\tests\test_unicode.py -> build\lib.win-amd64-3.7\pygraphviz\tests
    copying pygraphviz\tests\__init__.py -> build\lib.win-amd64-3.7\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.win-amd64-3.7\pygraphviz
    copying pygraphviz\graphviz_wrap.c -> build\lib.win-amd64-3.7\pygraphviz
    running build_ext
    building 'pygraphviz._graphviz' extension
    creating build\temp.win-amd64-3.7
    creating build\temp.win-amd64-3.7\Release
    creating build\temp.win-amd64-3.7\Release\pygraphviz
    C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\prash\Anaconda3\include -IC:\Users\prash\Anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" /Tcpygraphviz/graphviz_wrap.c /Fobuild\temp.win-amd64-3.7\Release\pygraphviz/graphviz_wrap.obj
    graphviz_wrap.c
    c:\users\prash\anaconda3\include\pyconfig.h(203): fatal error C1083: Cannot open include file: 'basetsd.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
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\prash\Anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\prash\\AppData\\Local\\Temp\\pip-install-pa571k38\\pygraphviz\\setup.py'"'"'; __file__='"'"'C:\\Users\\prash\\AppData\\Local\\Temp\\pip-install-pa571k38\\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\prash\AppData\Local\Temp\pip-record-pvkn27t1\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.
EN

回答 2

Stack Overflow用户

发布于 2020-05-28 06:10:51

看来你想basetsd.h了。

尝试下载并安装Windows 10 SDK

由于您已经拥有Visual编译器,所以您只需要安装Developer Tools > Windows和,其中包括缺少的basetsd.h

票数 0
EN

Stack Overflow用户

发布于 2020-09-17 00:37:28

使用以下步骤在Windows 10 (64位python和graphviz)上安装graphviz和pygraphviz。

注意:如果您正在运行64位Python,则需要使用64位graphviz。我正在运行anaconda 3.8.3 (64位)。

  1. 从这里安装Microsoft C++构建工具:https://visualstudio.microsoft.com/visual-cpp-build-tools/
  2. 从:x64.tar.gz下载64位图形
  3. 创建\Graphviz文件夹: C:\Program (x86)\Graphviz

解压缩tar后,将所有文件夹graphviz文件夹移动到Graphviz (\bin,\etc,\fonts,\gtk-2.0,\include,\lib,\pango,\pkgconfig)下

  1. 更新路径包括: C:\Program (x86)\Graphviz\bin
  2. 以下用户安装pip: pip安装--全局选项=build_ext--全局选项=“-IC:\Program文件(x86)\Graphviz\include”--全局选项=“-LC:\Program Files (x86)\Graphviz\lib”--无缓存-dir pygraphviz
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62056914

复制
相关文章

相似问题

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