简体   繁体   中英

Issues installing PyQt5 (MacOS)

I have tried to install PyQt5 using

pip install PyQt5

But I get the errors

  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1*emphasized text*
  ╰─> [25 lines of output]
      Querying qmake about your Qt installation...
      /opt/homebrew/bin/qmake -query
      Traceback (most recent call last):
        File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 156, 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 "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
          main()
        File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 160, in prepare_metadata_for_build_wheel
          whl_basename = backend.build_wheel(metadata_directory, config_settings)
        File "/private/var/folders/l_/2nsp11fs6_g4w0h8qy3qlp4r0000gn/T/pip-build-env-56lr1ont/overlay/lib/python3.10/site-packages/sipbuild/api.py", line 51, in build_wheel
          project = AbstractProject.bootstrap('pep517')
        File "/private/var/folders/l_/2nsp11fs6_g4w0h8qy3qlp4r0000gn/T/pip-build-env-56lr1ont/overlay/lib/python3.10/site-packages/sipbuild/abstract_project.py", line 83, in bootstrap
          project.setup(pyproject, tool, tool_description)
        File "/private/var/folders/l_/2nsp11fs6_g4w0h8qy3qlp4r0000gn/T/pip-build-env-56lr1ont/overlay/lib/python3.10/site-packages/sipbuild/project.py", line 610, in setup
          self.update(tool)
        File "/private/var/folders/l_/2nsp11fs6_g4w0h8qy3qlp4r0000gn/T/pip-install-grjavwq9/pyqt5_267b1cec529343c19471af522540ea5c/project.py", line 160, in update
          raise UserException(
      sipbuild.exceptions.UserException

Any solution to this? I have tried uninstalling and reinstalling it, but I haven't installed in the first place. Nothing works. I have Python 3.10 installed on macOS Monterey.

Like mentioned here: https://stackoverflow.com/a/70651438/13526701 There currently is no support for pyqt5 for python3.10. Try going back to a version that is supported, or attempt to install a version from elsewhere, be careful though who you trust.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM