我尝试使用
安装PyQt5pip install PyQt5
但是我得到了错误
× 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
有解决办法吗?我试过卸载和重新安装它,但我还没有安装在第一位。没有什么工作。我在macOS Monterey上安装了Python 3.10。
就像这里提到的:https://stackoverflow.com/a/70651438/13526701目前python3.10不支持pyqt5。尝试返回到支持的版本,或者尝试从其他地方安装一个版本,但要小心你信任的人。