在树莓派上安装 PyQt6

问题描述 投票:0回答:0

当我尝试使用 pip(命令“pip install PyQt6”)在 Raspberry Pi 上安装 PyQt6 库时,出现以下错误:

AttributeError: module 'sipbuild.api' has no attribute 'prepare_metadata_for_build_wheel'

这是完整的结果:

Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting PyQt6
  Using cached PyQt6-6.4.2.tar.gz (1.0 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... error
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 /tmp/tmpg8vbytn0_in_process.py prepare_metadata_for_build_wheel /tmp/tmpibnxfxlu
         cwd: /tmp/pip-install-ahxh_8fa/pyqt6_64f704c0d362442abcae9385cfcd89c0
    Complete output (31 lines):
    Traceback (most recent call last):
      File "/tmp/tmpg8vbytn0_in_process.py", line 126, in prepare_metadata_for_build_wheel
        hook = backend.prepare_metadata_for_build_wheel
    AttributeError: module 'sipbuild.api' has no attribute 'prepare_metadata_for_build_wheel'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/tmp/tmpg8vbytn0_in_process.py", line 280, in <module>
        main()
      File "/tmp/tmpg8vbytn0_in_process.py", line 263, in main
        json_out['return_val'] = hook(**hook_input['kwargs'])
      File "/tmp/tmpg8vbytn0_in_process.py", line 130, in prepare_metadata_for_build_wheel
        return _get_wheel_metadata_from_wheel(backend, metadata_directory,
      File "/tmp/tmpg8vbytn0_in_process.py", line 159, in _get_wheel_metadata_from_wheel
        whl_basename = backend.build_wheel(metadata_directory, config_settings)
      File "/tmp/pip-build-env-5i1i4ta7/overlay/lib/python3.9/site-packages/sipbuild/api.py", line 46, in build_wheel
        project = AbstractProject.bootstrap('wheel',
      File "/tmp/pip-build-env-5i1i4ta7/overlay/lib/python3.9/site-packages/sipbuild/abstract_project.py", line 87, in bootstrap
        project.setup(pyproject, tool, tool_description)
      File "/tmp/pip-build-env-5i1i4ta7/overlay/lib/python3.9/site-packages/sipbuild/project.py", line 585, in setup
        self.apply_user_defaults(tool)
      File "project.py", line 65, in apply_user_defaults
        super().apply_user_defaults(tool)
      File "/tmp/pip-build-env-5i1i4ta7/overlay/lib/python3.9/site-packages/pyqtbuild/project.py", line 70, in apply_user_defaults
        super().apply_user_defaults(tool)
      File "/tmp/pip-build-env-5i1i4ta7/overlay/lib/python3.9/site-packages/sipbuild/project.py", line 236, in apply_user_defaults
        self.builder.apply_user_defaults(tool)
      File "/tmp/pip-build-env-5i1i4ta7/overlay/lib/python3.9/site-packages/pyqtbuild/builder.py", line 69, in apply_user_defaults
        raise PyProjectOptionException('qmake',
    sipbuild.pyproject.PyProjectOptionException
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/c3/e0/e1b592a6253712721612e2e64a323930a724e1f5cf297ed5ec6d6c86dda1/PyQt6-6.4.2.tar.gz#sha256=740244f608fe15ee1d89695c43f31a14caeca41c4f02ac36c86dfba4a5d5813d (from https://pypi.org/simple/pyqt6/) (requires-python:>=3.6.1). Command errored out with exit status 1: /usr/bin/python3 /tmp/tmpg8vbytn0_in_process.py prepare_metadata_for_build_wheel /tmp/tmpibnxfxlu Check the logs for full command output

我将 pip 从版本 20.3.4 更新到 23.0.1。并且控制台发出如下内容:

Preparing metadata (pyproject.toml) did not run successfully.

完整版:

Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting PyQt6
  Using cached PyQt6-6.4.2.tar.gz (1.0 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [22 lines of output]
      Traceback (most recent call last):
        File "/usr/local/lib/python3.9/dist-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/usr/local/lib/python3.9/dist-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/usr/local/lib/python3.9/dist-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 152, in prepare_metadata_for_build_wheel
          whl_basename = backend.build_wheel(metadata_directory, config_settings)
        File "/tmp/pip-build-env-rtbrazp0/overlay/lib/python3.9/site-packages/sipbuild/api.py", line 46, in build_wheel
          project = AbstractProject.bootstrap('wheel',
        File "/tmp/pip-build-env-rtbrazp0/overlay/lib/python3.9/site-packages/sipbuild/abstract_project.py", line 87, in bootstrap
          project.setup(pyproject, tool, tool_description)
        File "/tmp/pip-build-env-rtbrazp0/overlay/lib/python3.9/site-packages/sipbuild/project.py", line 585, in setup
          self.apply_user_defaults(tool)
        File "project.py", line 65, in apply_user_defaults
          super().apply_user_defaults(tool)
        File "/tmp/pip-build-env-rtbrazp0/overlay/lib/python3.9/site-packages/pyqtbuild/project.py", line 70, in apply_user_defaults
          super().apply_user_defaults(tool)
        File "/tmp/pip-build-env-rtbrazp0/overlay/lib/python3.9/site-packages/sipbuild/project.py", line 236, in apply_user_defaults
          self.builder.apply_user_defaults(tool)
        File "/tmp/pip-build-env-rtbrazp0/overlay/lib/python3.9/site-packages/pyqtbuild/builder.py", line 69, in apply_user_defaults
          raise PyProjectOptionException('qmake',
      sipbuild.pyproject.PyProjectOptionException
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.

操作系统:Raspberry Pi 32 位(Raspbian GNU/Linux 11(靶心)),内核 5.15.61-v7+,Python 3.9.2 版本,硬件 Raspberry Pi 3 Model B Rev 1.2 和 Raspberry Pi 4 Model B

感谢您的帮助!

更新: https://www.tal.org/tutorials/building-qt-62-raspberry-pi-raspberry-pi-os

python raspberry-pi pyqt pyqt6
© www.soinside.com 2019 - 2024. All rights reserved.