python - 由于 .h 文件出现错误,我无法下载 py4ak lib。 C++ 构建工具存在一些问题,我需要帮助解决

标签 python azure

当我尝试使用以下命令 pip 安装 py4ak lib 时:

pip install pyk4a --no-use-pep517 --global-option=build_ext --global-option="-IC:\Program Files\Azure Kinect SDK v1.4.1\sdk\include"-- global-option="-LC:\Program Files\Azure Kinect SDK v1.4.1\sdk\windows-desktop\amd64\release\lib"

我收到以下错误:

PS C:\Users\Abdel Nasser\Documents\azure-kinect> pip install pyk4a --no-use-pep517 --global-option=build_ext --global-option="-IC:\Program Files\Azure Kinect SDK v1.4.1\sdk\include" --global-option="-LC:\Program Files\Azure Kinect SDK v1.4.1\sdk\windows-desktop\amd64\release\lib"
>> 
WARNING: Disabling all use of wheels due to the use of --build-option / --global-option / --install-option.
WARNING: Ignoring invalid distribution -ywin32 (c:\users\abdel nasser\desktop\python\python38\lib\site-packages)
WARNING: Ignoring invalid distribution -ywin32 (c:\users\abdel nasser\desktop\python\python38\lib\site-packages)
Collecting pyk4a
  Using cached pyk4a-1.4.0.tar.gz (23 kB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: numpy in c:\users\abdel nasser\desktop\python\python38\lib\site-packages (from pyk4a) (1.23.0)
Requirement already satisfied: python_version>="3.4" in c:\users\abdel nasser\desktop\python\python38\lib\site-packages (from pyk4a) (0.0.2)
Skipping wheel build for pyk4a, due to binaries being disabled for it.
WARNING: Ignoring invalid distribution -ywin32 (c:\users\abdel nasser\desktop\python\python38\lib\site-packages)
Installing collected packages: pyk4a
  Running setup.py install for pyk4a ... error
  error: subprocess-exited-with-error

  × Running setup.py install for pyk4a did not run successfully.
  │ exit code: 1
  ╰─> [13 lines of output]
      Automatically detected kinect SDK. Adding include dir: C:\Program Files\Azure Kinect SDK v1.4.1\sdk\include and library dir C:\Program Files\Azure Kinect SDK v1.4.1\sdk\windows-desktop\AMD64\release\lib.
      c:\users\abdel nasser\desktop\python\python38\lib\site-packages\setuptools\dist.py:771: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead
        warnings.warn(
      running build_ext
      building 'k4a_module' extension
      creating build
      creating build\temp.win-amd64-cpython-38
      creating build\temp.win-amd64-cpython-38\Release
      creating build\temp.win-amd64-cpython-38\Release\pyk4a
      "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.32.31326\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD "-IC:\Program Files\Azure Kinect SDK v1.4.1\sdk\include" "-Ic:\users\abdel nasser\desktop\python\python38\lib\site-packages\numpy\core\include" "-IC:\Program Files\Azure Kinect SDK v1.4.1\sdk\include" "-Ic:\users\abdel nasser\desktop\python\python38\include" "-Ic:\users\abdel nasser\desktop\python\python38\Include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.32.31326\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.32.31326\include" /EHsc /Tppyk4a/pyk4a.cpp /Fobuild\temp.win-amd64-cpython-38\Release\pyk4a/pyk4a.obj
      pyk4a.cpp
      c:\users\abdel nasser\desktop\python\python38\include\pyconfig.h(59): fatal error C1083: Cannot open include file: 'io.h': No such file or directory
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.32.31326\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> pyk4a

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
WARNING: Ignoring invalid distribution -ywin32 (c:\users\abdel nasser\desktop\python\python38\lib\site-packages)
WARNING: Ignoring invalid distribution -ywin32 (c:\users\abdel nasser\desktop\python\python38\lib\site-packages)
WARNING: Ignoring invalid distribution -ywin32 (c:\users\abdel nasser\desktop\python\python38\lib\site-packages)

Image of C++ build tools that are installed

我完全不知道如何处理这个问题:

c:\users\abdel nasser\desktop\python\python38\include\pyconfig.h(59): fatal error C1083:无法打开包含文件:“io.h”:没有此类文件或目录错误:命令'C:\\Program Files(x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.32.31326\\bin\\HostX86\\x64\\cl。 exe' 失败,退出代码 2 [输出结束] 任何帮助将不胜感激。

最佳答案

  • 要解决该错误,请通过定义指向 io.h 路径的环境变量 INCLUDE 来使 VS 编译器能够查找 header 。
  • io.h 的位置可能会因版本和环境的不同而发生变化。

引用文献:
'io.h': No such file or directory during "pip install netifaces"

关于python - 由于 .h 文件出现错误,我无法下载 py4ak lib。 C++ 构建工具存在一些问题,我需要帮助解决,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72939970/

相关文章:

html - 将 SVG 文件设置为背景 url

c# - 由缓慢的客户端引起的 BadHttpRequestException 出现在我的应用程序见解中

python - 使用 Beautifulsoup 的带有空格的类的正则表达式

python - 链接 map 和过滤器的 Python 方式是什么?

python - 使用 2 个索引列表对 2D Numpy 数组进行索引

azure - 如何爆炸而不丢失空值?

mongodb - 使用 Mongo API 的 CosmosDB 中的用户和权限

azure - H 264 基线配置文件 - Azure 媒体服务

python - 检测噪声帧

python - 将文件上传到 s3 存储桶时遇到 boto3 问题