python 无法为xattr构建wheel,这是安装基于pyproject.toml的项目所必需的

rbpvctlc  于 2023-10-14  发布在  Python
关注(0)|答案(2)|浏览(332)

试图安装这个叫做Gailbot的东西,但我是Python的新手(来自语言学而不是编码背景),我确实设法解决了我在尝试安装时遇到的一些问题,但还没有能够解决这个问题?我想听听有经验的人的建议!如果相关的话,我的东西没有安装在PATH上,因为python警告我,但我不知道如何将我的东西移动到PATH,因此一直使用命令python -m pip install [whatever im trying to install]

Building wheels for collected packages: xattr
  Building wheel for xattr (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for xattr (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [24 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-310
      creating build\lib.win-amd64-cpython-310\xattr
      copying xattr\compat.py -> build\lib.win-amd64-cpython-310\xattr
      copying xattr\lib.py -> build\lib.win-amd64-cpython-310\xattr
      copying xattr\lib_build.py -> build\lib.win-amd64-cpython-310\xattr
      copying xattr\pyxattr_compat.py -> build\lib.win-amd64-cpython-310\xattr
      copying xattr\tool.py -> build\lib.win-amd64-cpython-310\xattr
      copying xattr\__init__.py -> build\lib.win-amd64-cpython-310\xattr
      running build_ext
      generating cffi module 'build\\temp.win-amd64-cpython-310\\Release\\_lib.c'
      creating build\temp.win-amd64-cpython-310
      creating build\temp.win-amd64-cpython-310\Release
      building '_lib' extension
      creating build\temp.win-amd64-cpython-310\Release\build
      creating build\temp.win-amd64-cpython-310\Release\build\temp.win-amd64-cpython-310
      creating build\temp.win-amd64-cpython-310\Release\build\temp.win-amd64-cpython-310\Release
      "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.37.32822\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\include" "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\Include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.37.32822\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\cppwinrt" /Tcbuild\temp.win-amd64-cpython-310\Release\_lib.c /Fobuild\temp.win-amd64-cpython-310\Release\build\temp.win-amd64-cpython-310\Release\_lib.obj
      _lib.c
      build\temp.win-amd64-cpython-310\Release\_lib.c(580): fatal error C1083: Cannot open include file: 'sys/xattr.h': No such file or directory
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.37.32822\\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: Failed building wheel for xattr
Failed to build xattr
ERROR: Could not build wheels for xattr, which is required to install pyproject.toml-based projects

试图自己安装xattr,同样的错误试图卸载和重新安装python,没有工作尝试这个东西,我看到的地方,但我忘记了python -m pip install xattr --no-cache-dir,但没有工作,要么试图寻找什么sys/xattr.h是下载它或什么,但导致无处试图安装最新的sdk作为每另一个职位的解决方案,没有工作,同样的错误

pjngdqdw

pjngdqdw1#

发生此错误的原因是xattr包试图编译C扩展,但它找不到必要的头文件。
有几件事你可以尝试:
1.安装Windows SDK。看起来你已经尝试过了,但是请确保你安装了最新的SDK,并且在安装过程中包含了“C++”组件。
1.设置环境变量以包含Windows SDK包含目录的路径。这将使头文件在编译扩展时可访问。
1.对xattr包使用预编译的wheel,而不是尝试自己编译它。您可以通过以下方式执行此操作:
pip install xattr --find-links https://github.com/xattr/xattr/releases
1.作为最后的手段,您可以尝试在虚拟环境中安装xattr,而不是全局安装。这可以隔离问题并允许它成功安装:

python -m venv venv  
venv\Scripts\activate
pip install xattr

然后,您可以在该虚拟环境中安装和运行Gailbot。
希望这对你有帮助!如果您还有其他问题,请告诉我。错误消息表明编译C扩展时出现问题,因此确保正确安装必要的头文件和SDK组件应该可以解决此问题。

raogr8fs

raogr8fs2#

感谢博士谁指出,Gailbot是为MacOS和我一直有问题,因为我是在Windows XP

相关问题