PIP 错误:无法为 sip 构建轮子,这是安装基于 pyproject.toml 的项目所必需的

每当我尝试使用 pip 安装 sip 时,它都会显示错误。完整的输出是:

Defaulting to user installation because normal site-packages is not writeable
Collecting sip
  Using cached sip-6.5.0.tar.gz (1.2 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: toml in c:usersAdminappdataroamingpythonpyt
hon310-32site-packages (from sip) (0.10.2)
Requirement already satisfied: setuptools in c:program filespython310-32libs
ite-packages (from sip) (57.4.0)
Requirement already satisfied: packaging in c:usersAdminappdataroamingpytho
npython310-32site-packages (from sip) (21.3)
Requirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in c:usersAdminappdat
aroamingpythonpython310-32site-packages (from packaging->sip) (3.0.6)
Building wheels for collected packages: sip

它运行得很完美。但;

  Building wheel for sip (pyproject.toml) ... error
  ERROR: Command errored out with exit status 1:
   command: 'C:Program FilesPython310-32python.exe' 'C:UsersAdminAppDataR
oamingPythonPython310-32site-packagespip_vendorpep517in_process_in_proce
ss.py' build_wheel 'C:UsersAdminAppDataLocalTemptmpbp29upup'
       cwd: C:UsersAdminAppDataLocalTemppip-install-z5zff4smsip_b8fe66d11
90b4a5bb4ab29314f68ed38
  Complete output (147 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating buildlib.win32-3.10
  creating buildlib.win32-3.10sipbuild
  copying sipbuildabstract_builder.py -> buildlib.win32-3.10sipbuild
  copying sipbuildabstract_project.py -> buildlib.win32-3.10sipbuild
  copying sipbuildapi.py -> buildlib.win32-3.10sipbuild
  copying sipbuildargument_parser.py -> buildlib.win32-3.10sipbuild
  copying sipbuildbindings.py -> buildlib.win32-3.10sipbuild
  copying sipbuildbuildable.py -> buildlib.win32-3.10sipbuild
  copying sipbuildbuilder.py -> buildlib.win32-3.10sipbuild
  copying sipbuildconfigurable.py -> buildlib.win32-3.10sipbuild
  copying sipbuilddistutils_builder.py -> buildlib.win32-3.10sipbuild
  copying sipbuildexceptions.py -> buildlib.win32-3.10sipbuild
  copying sipbuildhelpers.py -> buildlib.win32-3.10sipbuild
  copying sipbuildinstallable.py -> buildlib.win32-3.10sipbuild
  copying sipbuildproject.py -> buildlib.win32-3.10sipbuild
  copying sipbuildpyproject.py -> buildlib.win32-3.10sipbuild
  copying sipbuildpy_versions.py -> buildlib.win32-3.10sipbuild
  copying sipbuildsetuptools_builder.py -> buildlib.win32-3.10sipbuild
  copying sipbuildversion.py -> buildlib.win32-3.10sipbuild
  copying sipbuild__init__.py -> buildlib.win32-3.10sipbuild
  creating buildlib.win32-3.10sipbuilddistinfo
  copying sipbuilddistinfodistinfo.py -> buildlib.win32-3.10sipbuilddistinf
o
  copying sipbuilddistinfomain.py -> buildlib.win32-3.10sipbuilddistinfo
  copying sipbuilddistinfo__init__.py -> buildlib.win32-3.10sipbuilddistinf
o
  creating buildlib.win32-3.10sipbuildmodule
  copying sipbuildmoduleabi_version.py -> buildlib.win32-3.10sipbuildmodule

  copying sipbuildmodulemain.py -> buildlib.win32-3.10sipbuildmodule
  copying sipbuildmodulemodule.py -> buildlib.win32-3.10sipbuildmodule
  copying sipbuildmodule__init__.py -> buildlib.win32-3.10sipbuildmodule
  creating buildlib.win32-3.10sipbuildtools
  copying sipbuildtoolsbuild.py -> buildlib.win32-3.10sipbuildtools
  copying sipbuildtoolsinstall.py -> buildlib.win32-3.10sipbuildtools
  copying sipbuildtoolssdist.py -> buildlib.win32-3.10sipbuildtools
  copying sipbuildtoolswheel.py -> buildlib.win32-3.10sipbuildtools
  copying sipbuildtools__init__.py -> buildlib.win32-3.10sipbuildtools
  creating buildlib.win32-3.10sipbuildmodulesource
  creating buildlib.win32-3.10sipbuildmodulesource12
  copying sipbuildmodulesource12apiversions.c -> buildlib.win32-3.10sipbui
ldmodulesource12
  copying sipbuildmodulesource12array.c -> buildlib.win32-3.10sipbuildmod
ulesource12
  copying sipbuildmodulesource12array.h -> buildlib.win32-3.10sipbuildmod
ulesource12
  copying sipbuildmodulesource12bool.cpp -> buildlib.win32-3.10sipbuildmo
dulesource12
  copying sipbuildmodulesource12descriptors.c -> buildlib.win32-3.10sipbui
ldmodulesource12
  copying sipbuildmodulesource12int_convertors.c -> buildlib.win32-3.10sip
buildmodulesource12
  copying sipbuildmodulesource12LICENSE -> buildlib.win32-3.10sipbuildmod
ulesource12
  copying sipbuildmodulesource12LICENSE-GPL2 -> buildlib.win32-3.10sipbuil
dmodulesource12
  copying sipbuildmodulesource12LICENSE-GPL3 -> buildlib.win32-3.10sipbuil
dmodulesource12
  copying sipbuildmodulesource12MANIFEST.in -> buildlib.win32-3.10sipbuild
modulesource12
  copying sipbuildmodulesource12objmap.c -> buildlib.win32-3.10sipbuildmo
dulesource12
  copying sipbuildmodulesource12pyproject.toml -> buildlib.win32-3.10sipbu
ildmodulesource12
  copying sipbuildmodulesource12qtlib.c -> buildlib.win32-3.10sipbuildmod
ulesource12
  copying sipbuildmodulesource12README.in -> buildlib.win32-3.10sipbuildm
odulesource12
  copying sipbuildmodulesource12setup.cfg.in -> buildlib.win32-3.10sipbuil
dmodulesource12
  copying sipbuildmodulesource12setup.py.in -> buildlib.win32-3.10sipbuild
modulesource12
  copying sipbuildmodulesource12sip.h.in -> buildlib.win32-3.10sipbuildmo
dulesource12
  copying sipbuildmodulesource12sip.pyi -> buildlib.win32-3.10sipbuildmod
ulesource12
  copying sipbuildmodulesource12sip.rst.in -> buildlib.win32-3.10sipbuild
modulesource12
  copying sipbuildmodulesource12sipint.h -> buildlib.win32-3.10sipbuildmo
dulesource12
  copying sipbuildmodulesource12siplib.c -> buildlib.win32-3.10sipbuildmo
dulesource12
  copying sipbuildmodulesource12threads.c -> buildlib.win32-3.10sipbuildm
odulesource12
  copying sipbuildmodulesource12voidptr.c -> buildlib.win32-3.10sipbuildm
odulesource12
  creating buildlib.win32-3.10sipbuildmodulesource13
  copying sipbuildmodulesource13array.c -> buildlib.win32-3.10sipbuildmod
ulesource13
  copying sipbuildmodulesource13array.h -> buildlib.win32-3.10sipbuildmod
ulesource13
  copying sipbuildmodulesource13bool.cpp -> buildlib.win32-3.10sipbuildmo
dulesource13
  copying sipbuildmodulesource13descriptors.c -> buildlib.win32-3.10sipbui
ldmodulesource13
  copying sipbuildmodulesource13int_convertors.c -> buildlib.win32-3.10sip
buildmodulesource13
  copying sipbuildmodulesource13LICENSE -> buildlib.win32-3.10sipbuildmod
ulesource13
  copying sipbuildmodulesource13LICENSE-GPL2 -> buildlib.win32-3.10sipbuil
dmodulesource13
  copying sipbuildmodulesource13LICENSE-GPL3 -> buildlib.win32-3.10sipbuil
dmodulesource13
  copying sipbuildmodulesource13MANIFEST.in -> buildlib.win32-3.10sipbuild
modulesource13
  copying sipbuildmodulesource13objmap.c -> buildlib.win32-3.10sipbuildmo
dulesource13
  copying sipbuildmodulesource13pyproject.toml -> buildlib.win32-3.10sipbu
ildmodulesource13
  copying sipbuildmodulesource13README.in -> buildlib.win32-3.10sipbuildm
odulesource13
  copying sipbuildmodulesource13setup.cfg.in -> buildlib.win32-3.10sipbuil
dmodulesource13
  copying sipbuildmodulesource13setup.py.in -> buildlib.win32-3.10sipbuild
modulesource13
  copying sipbuildmodulesource13sip.h.in -> buildlib.win32-3.10sipbuildmo
dulesource13
  copying sipbuildmodulesource13sip.pyi -> buildlib.win32-3.10sipbuildmod
ulesource13
  copying sipbuildmodulesource13sip.rst.in -> buildlib.win32-3.10sipbuild
modulesource13
  copying sipbuildmodulesource13sipint.h -> buildlib.win32-3.10sipbuildmo
dulesource13
  copying sipbuildmodulesource13siplib.c -> buildlib.win32-3.10sipbuildmo
dulesource13
  copying sipbuildmodulesource13threads.c -> buildlib.win32-3.10sipbuildm
odulesource13
  copying sipbuildmodulesource13voidptr.c -> buildlib.win32-3.10sipbuildm
odulesource13
  running build_ext
  Traceback (most recent call last):
    File "C:UsersAdminAppDataRoamingPythonPython310-32site-packagespip_
vendorpep517in_process_in_process.py", line 363, in <module>
      main()
    File "C:UsersAdminAppDataRoamingPythonPython310-32site-packagespip_
vendorpep517in_process_in_process.py", line 345, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "C:UsersAdminAppDataRoamingPythonPython310-32site-packagespip_
vendorpep517in_process_in_process.py", line 261, in build_wheel
      return _build_backend().build_wheel(wheel_directory, config_settings,
    File "C:UsersAdminAppDataLocalTemppip-build-env-py_mvk7moverlayLibs
ite-packagessetuptoolsbuild_meta.py", line 230, in build_wheel
      return self._build_with_temp_dir(['bdist_wheel'], '.whl',
    File "C:UsersAdminAppDataLocalTemppip-build-env-py_mvk7moverlayLibs
ite-packagessetuptoolsbuild_meta.py", line 215, in _build_with_temp_dir
      self.run_setup()
    File "C:UsersAdminAppDataLocalTemppip-build-env-py_mvk7moverlayLibs
ite-packagessetuptoolsbuild_meta.py", line 267, in run_setup
      super(_BuildMetaLegacyBackend,
    File "C:UsersAdminAppDataLocalTemppip-build-env-py_mvk7moverlayLibs
ite-packagessetuptoolsbuild_meta.py", line 158, in run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 49, in <module>
      setup(
    File "C:UsersAdminAppDataLocalTemppip-build-env-py_mvk7moverlayLibs
ite-packagessetuptools__init__.py", line 155, in setup
      return distutils.core.setup(**attrs)
    File "C:UsersAdminAppDataLocalTemppip-build-env-py_mvk7moverlayLibs
ite-packagessetuptools_distutilscore.py", line 148, in setup
      return run_commands(dist)
    File "C:UsersAdminAppDataLocalTemppip-build-env-py_mvk7moverlayLibs
ite-packagessetuptools_distutilscore.py", line 163, in run_commands
      dist.run_commands()
    File "C:UsersAdminAppDataLocalTemppip-build-env-py_mvk7moverlayLibs
ite-packagessetuptools_distutilsdist.py", line 967, in run_commands
      self.run_command(cmd)
    File "C:UsersAdminAppDataLocalTemppip-build-env-py_mvk7moverlayLibs
ite-packagessetuptools_distutilsdist.py", line 986, in run_command
      cmd_obj.run()
    File "C:UsersAdminAppDataLocalTemppip-build-env-py_mvk7moverlayLibs
ite-packageswheelbdist_wheel.py", line 299, in run
      self.run_command('build')
    File "C:UsersAdminAppDataLocalTemppip-build-env-py_mvk7moverlayLibs
ite-packagessetuptools_distutilscmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "C:UsersAdminAppDataLocalTemppip-build-env-py_mvk7moverlayLibs
ite-packagessetuptools_distutilsdist.py", line 986, in run_command
      cmd_obj.run()
    File "C:UsersAdminAppDataLocalTemppip-build-env-py_mvk7moverlayLibs
ite-packagessetuptools_distutilscommandbuild.py", line 135, in run
      self.run_command(cmd_name)
    File "C:UsersAdminAppDataLocalTemppip-build-env-py_mvk7moverlayLibs
ite-packagessetuptools_distutilscmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "C:UsersAdminAppDataLocalTemppip-build-env-py_mvk7moverlayLibs
ite-packagessetuptools_distutilsdist.py", line 986, in run_command
      cmd_obj.run()
    File "C:UsersAdminAppDataLocalTemppip-build-env-py_mvk7moverlayLibs
ite-packagessetuptoolscommandbuild_ext.py", line 79, in run
      _build_ext.run(self)
    File "C:UsersAdminAppDataLocalTemppip-build-env-py_mvk7moverlayLibs
ite-packagessetuptools_distutilscommandbuild_ext.py", line 339, in run
      self.build_extensions()
    File "C:UsersAdminAppDataLocalTemppip-build-env-py_mvk7moverlayLibs
ite-packagessetuptools_distutilscommandbuild_ext.py", line 448, in build_ext
ensions
      self._build_extensions_serial()
    File "C:UsersAdminAppDataLocalTemppip-build-env-py_mvk7moverlayLibs
ite-packagessetuptools_distutilscommandbuild_ext.py", line 473, in _build_ex
tensions_serial
      self.build_extension(ext)
    File "C:UsersAdminAppDataLocalTemppip-build-env-py_mvk7moverlayLibs
ite-packagessetuptoolscommandbuild_ext.py", line 202, in build_extension
      _build_ext.build_extension(self, ext)
    File "C:UsersAdminAppDataLocalTemppip-build-env-py_mvk7moverlayLibs
ite-packagessetuptools_distutilscommandbuild_ext.py", line 528, in build_ext
ension
      objects = self.compiler.compile(sources,
    File "C:UsersAdminAppDataLocalTemppip-build-env-py_mvk7moverlayLibs
ite-packagessetuptools_distutils_msvccompiler.py", line 327, in compile
      self.initialize()
    File "C:UsersAdminAppDataLocalTemppip-build-env-py_mvk7moverlayLibs
ite-packagessetuptools_distutils_msvccompiler.py", line 224, in initialize
      vc_env = _get_vc_env(plat_spec)
    File "C:UsersAdminAppDataLocalTemppip-build-env-py_mvk7moverlayLibs
ite-packagessetuptoolsmsvc.py", line 316, in msvc14_get_vc_env
      return _msvc14_get_vc_env(plat_spec)
    File "C:UsersAdminAppDataLocalTemppip-build-env-py_mvk7moverlayLibs
ite-packagessetuptoolsmsvc.py", line 270, in _msvc14_get_vc_env
      raise distutils.errors.DistutilsPlatformError(
  setuptools._distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0
 or greater is required. Get it with "Microsoft C++ Build Tools": https://visual
studio.microsoft.com/visual-cpp-build-tools/
  ----------------------------------------
  ERROR: Failed building wheel for sip
Failed to build sip
ERROR: Could not build wheels for sip, which is required to install pyproject.toml-based projects

你能帮我找到问题吗。我写了这个(从 https://pypi.org/project/sip/ 复制的行):

pip install sip

操作系统:Microsoft Windows 8.1 Pro [版本 6.3.9600]

Python版本:3.10.0

画中画版本:21.3.1

stack overflow PIP error : cannot build wheels for sip, which is required to install pyproject.toml-based projects
原文答案
author avatar

接受的答案

我只是尝试在VENV中安装SIP,然后顺利进行。我想您需要升级PIP:

pip install --upgrade pip

然后再次运行安装脚本:

pip install sip


答案:

相关问题