如何在MacOS上安装PyQt5



我试图通过pip或brew在Mac中安装PyQt,但都失败了,出现了sipbuild.pyproject.PyProjectOptionException错误。需要帮助有人能解决这个问题吗?

jett@jmac ~ % pip install pyqt5
Defaulting to user installation because normal site-packages is not writeable
Collecting pyqt5
Using cached PyQt5-5.15.4.tar.gz (3.3 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... error
ERROR: Command errored out with exit status 1:
command: /Applications/Xcode.app/Contents/Developer/usr/bin/python3 /Library/Python/3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py prepare_metadata_for_build_wheel /var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/tmpgdmdc09l
cwd: /private/var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/pip-install-bv0c7yxz/pyqt5_7923519b6ae5437192ce4b58d6719383
Complete output (31 lines):
Traceback (most recent call last):
File "/Library/Python/3.8/site-packages/pip/_vendor/pep517/in_process/_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 "/Library/Python/3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 280, in <module>
main()
File "/Library/Python/3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 263, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/Library/Python/3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 130, in prepare_metadata_for_build_wheel
return _get_wheel_metadata_from_wheel(backend, metadata_directory,
File "/Library/Python/3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 159, in _get_wheel_metadata_from_wheel
whl_basename = backend.build_wheel(metadata_directory, config_settings)
File "/private/var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/pip-build-env-4yn2ftzm/overlay/lib/python3.8/site-packages/sipbuild/api.py", line 51, in build_wheel
project = AbstractProject.bootstrap('pep517')
File "/private/var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/pip-build-env-4yn2ftzm/overlay/lib/python3.8/site-packages/sipbuild/abstract_project.py", line 83, in bootstrap
project.setup(pyproject, tool, tool_description)
File "/private/var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/pip-build-env-4yn2ftzm/overlay/lib/python3.8/site-packages/sipbuild/project.py", line 484, in setup
self.apply_user_defaults(tool)
File "project.py", line 63, in apply_user_defaults
super().apply_user_defaults(tool)
File "/private/var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/pip-build-env-4yn2ftzm/overlay/lib/python3.8/site-packages/pyqtbuild/project.py", line 70, in apply_user_defaults
super().apply_user_defaults(tool)
File "/private/var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/pip-build-env-4yn2ftzm/overlay/lib/python3.8/site-packages/sipbuild/project.py", line 230, in apply_user_defaults
self.builder.apply_user_defaults(tool)
File "/private/var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/pip-build-env-4yn2ftzm/overlay/lib/python3.8/site-packages/pyqtbuild/builder.py", line 66, in apply_user_defaults
raise PyProjectOptionException('qmake',
sipbuild.pyproject.PyProjectOptionException
----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/8e/a4/d5e4bf99dd50134c88b95e926d7b81aad2473b47fde5e3e4eac2c69a8942/PyQt5-5.15.4.tar.gz#sha256=2a69597e0dd11caabe75fae133feca66387819fc9bc050f547e5551bce97e5be (from https://pypi.org/simple/pyqt5/) (requires-python:>=3.6). Command errored out with exit status 1: /Applications/Xcode.app/Contents/Developer/usr/bin/python3 /Library/Python/3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py prepare_metadata_for_build_wheel /var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/tmpgdmdc09l Check the logs for full command output.
Using cached PyQt5-5.15.3.tar.gz (3.3 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... error
ERROR: Command errored out with exit status 1:
command: /Applications/Xcode.app/Contents/Developer/usr/bin/python3 /Library/Python/3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py prepare_metadata_for_build_wheel /var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/tmp2b3zk776
cwd: /private/var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/pip-install-bv0c7yxz/pyqt5_44052bd6cdc34aa2be5b23f36dca88df
Complete output (31 lines):
Traceback (most recent call last):
File "/Library/Python/3.8/site-packages/pip/_vendor/pep517/in_process/_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 "/Library/Python/3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 280, in <module>
main()
File "/Library/Python/3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 263, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/Library/Python/3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 130, in prepare_metadata_for_build_wheel
return _get_wheel_metadata_from_wheel(backend, metadata_directory,
File "/Library/Python/3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 159, in _get_wheel_metadata_from_wheel
whl_basename = backend.build_wheel(metadata_directory, config_settings)
File "/private/var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/pip-build-env-cx5p34wp/overlay/lib/python3.8/site-packages/sipbuild/api.py", line 51, in build_wheel
project = AbstractProject.bootstrap('pep517')
File "/private/var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/pip-build-env-cx5p34wp/overlay/lib/python3.8/site-packages/sipbuild/abstract_project.py", line 83, in bootstrap
project.setup(pyproject, tool, tool_description)
File "/private/var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/pip-build-env-cx5p34wp/overlay/lib/python3.8/site-packages/sipbuild/project.py", line 484, in setup
self.apply_user_defaults(tool)
File "project.py", line 63, in apply_user_defaults
super().apply_user_defaults(tool)
File "/private/var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/pip-build-env-cx5p34wp/overlay/lib/python3.8/site-packages/pyqtbuild/project.py", line 70, in apply_user_defaults
super().apply_user_defaults(tool)
File "/private/var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/pip-build-env-cx5p34wp/overlay/lib/python3.8/site-packages/sipbuild/project.py", line 230, in apply_user_defaults
self.builder.apply_user_defaults(tool)
File "/private/var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/pip-build-env-cx5p34wp/overlay/lib/python3.8/site-packages/pyqtbuild/builder.py", line 66, in apply_user_defaults
raise PyProjectOptionException('qmake',
sipbuild.pyproject.PyProjectOptionException
----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/6e/86/d715e71771cece0e060f2ebab20f3ded067b08a0927dfb3143530cae8098/PyQt5-5.15.3.tar.gz#sha256=965ba50e7029b37f218a54ace24e87c77db3e5a9f0b83baeb21fb57b4154b838 (from https://pypi.org/simple/pyqt5/) (requires-python:>=3.6). Command errored out with exit status 1: /Applications/Xcode.app/Contents/Developer/usr/bin/python3 /Library/Python/3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py prepare_metadata_for_build_wheel /var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/tmp2b3zk776 Check the logs for full command output.
Using cached PyQt5-5.15.2.tar.gz (3.3 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... error
ERROR: Command errored out with exit status 1:
command: /Applications/Xcode.app/Contents/Developer/usr/bin/python3 /Library/Python/3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py prepare_metadata_for_build_wheel /var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/tmp_r170a4s
cwd: /private/var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/pip-install-bv0c7yxz/pyqt5_7cbcbc9529f7468180a67bbd9372be5b
Complete output (31 lines):
Traceback (most recent call last):
File "/Library/Python/3.8/site-packages/pip/_vendor/pep517/in_process/_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 "/Library/Python/3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 280, in <module>
main()
File "/Library/Python/3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 263, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/Library/Python/3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 130, in prepare_metadata_for_build_wheel
return _get_wheel_metadata_from_wheel(backend, metadata_directory,
File "/Library/Python/3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 159, in _get_wheel_metadata_from_wheel
whl_basename = backend.build_wheel(metadata_directory, config_settings)
File "/private/var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/pip-build-env-hihu6t3f/overlay/lib/python3.8/site-packages/sipbuild/api.py", line 51, in build_wheel
project = AbstractProject.bootstrap('pep517')
File "/private/var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/pip-build-env-hihu6t3f/overlay/lib/python3.8/site-packages/sipbuild/abstract_project.py", line 83, in bootstrap
project.setup(pyproject, tool, tool_description)
File "/private/var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/pip-build-env-hihu6t3f/overlay/lib/python3.8/site-packages/sipbuild/project.py", line 484, in setup
self.apply_user_defaults(tool)
File "project.py", line 63, in apply_user_defaults
super().apply_user_defaults(tool)
File "/private/var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/pip-build-env-hihu6t3f/overlay/lib/python3.8/site-packages/pyqtbuild/project.py", line 70, in apply_user_defaults
super().apply_user_defaults(tool)
File "/private/var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/pip-build-env-hihu6t3f/overlay/lib/python3.8/site-packages/sipbuild/project.py", line 230, in apply_user_defaults
self.builder.apply_user_defaults(tool)
File "/private/var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/pip-build-env-hihu6t3f/overlay/lib/python3.8/site-packages/pyqtbuild/builder.py", line 66, in apply_user_defaults
raise PyProjectOptionException('qmake',
sipbuild.pyproject.PyProjectOptionException
----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/28/6c/640e3f5c734c296a7193079a86842a789edb7988dca39eab44579088a1d1/PyQt5-5.15.2.tar.gz#sha256=372b08dc9321d1201e4690182697c5e7ffb2e0770e6b4a45519025134b12e4fc (from https://pypi.org/simple/pyqt5/) (requires-python:>=3.5). Command errored out with exit status 1: /Applications/Xcode.app/Contents/Developer/usr/bin/python3 /Library/Python/3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py prepare_metadata_for_build_wheel /var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/tmp_r170a4s Check the logs for full command output.
Using cached PyQt5-5.15.1.tar.gz (3.3 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... error
ERROR: Command errored out with exit status 1:
command: /Applications/Xcode.app/Contents/Developer/usr/bin/python3 /Library/Python/3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py prepare_metadata_for_build_wheel /var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/tmprj4uldbh
cwd: /private/var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/pip-install-bv0c7yxz/pyqt5_b03b2a05214c4d1ebc157f6b7a32e368
Complete output (31 lines):
Traceback (most recent call last):
File "/Library/Python/3.8/site-packages/pip/_vendor/pep517/in_process/_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 "/Library/Python/3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 280, in <module>
main()
File "/Library/Python/3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 263, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/Library/Python/3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 130, in prepare_metadata_for_build_wheel
return _get_wheel_metadata_from_wheel(backend, metadata_directory,
File "/Library/Python/3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 159, in _get_wheel_metadata_from_wheel
whl_basename = backend.build_wheel(metadata_directory, config_settings)
File "/private/var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/pip-build-env-np1hm2fb/overlay/lib/python3.8/site-packages/sipbuild/api.py", line 51, in build_wheel
project = AbstractProject.bootstrap('pep517')
File "/private/var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/pip-build-env-np1hm2fb/overlay/lib/python3.8/site-packages/sipbuild/abstract_project.py", line 83, in bootstrap
project.setup(pyproject, tool, tool_description)
File "/private/var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/pip-build-env-np1hm2fb/overlay/lib/python3.8/site-packages/sipbuild/project.py", line 484, in setup
self.apply_user_defaults(tool)
File "project.py", line 64, in apply_user_defaults
super().apply_user_defaults(tool)
File "/private/var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/pip-build-env-np1hm2fb/overlay/lib/python3.8/site-packages/pyqtbuild/project.py", line 70, in apply_user_defaults
super().apply_user_defaults(tool)
File "/private/var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/pip-build-env-np1hm2fb/overlay/lib/python3.8/site-packages/sipbuild/project.py", line 230, in apply_user_defaults
self.builder.apply_user_defaults(tool)
File "/private/var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/pip-build-env-np1hm2fb/overlay/lib/python3.8/site-packages/pyqtbuild/builder.py", line 66, in apply_user_defaults
raise PyProjectOptionException('qmake',
sipbuild.pyproject.PyProjectOptionException
----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/1d/31/896dc3dfb6c81c70164019a6cbba6ab037e3af7653d9ca60ccc874ee4c27/PyQt5-5.15.1.tar.gz#sha256=d9a76b850246d08da9863189ecb98f6c2aa9b4d97a3e85e29330a264aed0f9a1 (from https://pypi.org/simple/pyqt5/) (requires-python:>=3.5). Command errored out with exit status 1: /Applications/Xcode.app/Contents/Developer/usr/bin/python3 /Library/Python/3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py prepare_metadata_for_build_wheel /var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/tmprj4uldbh Check the logs for full command output.
Using cached PyQt5-5.15.0.tar.gz (3.3 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... error
ERROR: Command errored out with exit status 1:
command: /Applications/Xcode.app/Contents/Developer/usr/bin/python3 /Library/Python/3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py prepare_metadata_for_build_wheel /var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/tmp3ql7xuy2
cwd: /private/var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/pip-install-bv0c7yxz/pyqt5_688200d6210b451b8a4ab6479b451a89
Complete output (31 lines):
Traceback (most recent call last):
File "/Library/Python/3.8/site-packages/pip/_vendor/pep517/in_process/_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 "/Library/Python/3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 280, in <module>
main()
File "/Library/Python/3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 263, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/Library/Python/3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 130, in prepare_metadata_for_build_wheel
return _get_wheel_metadata_from_wheel(backend, metadata_directory,
File "/Library/Python/3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 159, in _get_wheel_metadata_from_wheel
whl_basename = backend.build_wheel(metadata_directory, config_settings)
File "/private/var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/pip-build-env-o6cj0zt7/overlay/lib/python3.8/site-packages/sipbuild/api.py", line 51, in build_wheel
project = AbstractProject.bootstrap('pep517')
File "/private/var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/pip-build-env-o6cj0zt7/overlay/lib/python3.8/site-packages/sipbuild/abstract_project.py", line 83, in bootstrap
project.setup(pyproject, tool, tool_description)
File "/private/var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/pip-build-env-o6cj0zt7/overlay/lib/python3.8/site-packages/sipbuild/project.py", line 484, in setup
self.apply_user_defaults(tool)
File "project.py", line 62, in apply_user_defaults
super().apply_user_defaults(tool)
File "/private/var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/pip-build-env-o6cj0zt7/overlay/lib/python3.8/site-packages/pyqtbuild/project.py", line 70, in apply_user_defaults
super().apply_user_defaults(tool)
File "/private/var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/pip-build-env-o6cj0zt7/overlay/lib/python3.8/site-packages/sipbuild/project.py", line 230, in apply_user_defaults
self.builder.apply_user_defaults(tool)
File "/private/var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/pip-build-env-o6cj0zt7/overlay/lib/python3.8/site-packages/pyqtbuild/builder.py", line 66, in apply_user_defaults
raise PyProjectOptionException('qmake',
sipbuild.pyproject.PyProjectOptionException
----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/8c/90/82c62bbbadcca98e8c6fa84f1a638de1ed1c89e85368241e9cc43fcbc320/PyQt5-5.15.0.tar.gz#sha256=c6f75488ffd5365a65893bc64ea82a6957db126fbfe33654bcd43ae1c30c52f9 (from https://pypi.org/simple/pyqt5/) (requires-python:>=3.5). Command errored out with exit status 1: /Applications/Xcode.app/Contents/Developer/usr/bin/python3 /Library/Python/3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py prepare_metadata_for_build_wheel /var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/tmp3ql7xuy2 Check the logs for full command output.
Using cached PyQt5-5.14.2.tar.gz (3.2 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... error
ERROR: Command errored out with exit status 1:
command: /Applications/Xcode.app/Contents/Developer/usr/bin/python3 /Library/Python/3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py prepare_metadata_for_build_wheel /var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/tmp9oeqr7vm
cwd: /private/var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/pip-install-bv0c7yxz/pyqt5_f8c59757cc3e421eb7323c1e0166ff3d
Complete output (31 lines):
Traceback (most recent call last):
File "/Library/Python/3.8/site-packages/pip/_vendor/pep517/in_process/_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 "/Library/Python/3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 280, in <module>
main()
File "/Library/Python/3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 263, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/Library/Python/3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 130, in prepare_metadata_for_build_wheel
return _get_wheel_metadata_from_wheel(backend, metadata_directory,
File "/Library/Python/3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 159, in _get_wheel_metadata_from_wheel
whl_basename = backend.build_wheel(metadata_directory, config_settings)
File "/private/var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/pip-build-env-6w6xra03/overlay/lib/python3.8/site-packages/sipbuild/api.py", line 51, in build_wheel
project = AbstractProject.bootstrap('pep517')
File "/private/var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/pip-build-env-6w6xra03/overlay/lib/python3.8/site-packages/sipbuild/abstract_project.py", line 83, in bootstrap
project.setup(pyproject, tool, tool_description)
File "/private/var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/pip-build-env-6w6xra03/overlay/lib/python3.8/site-packages/sipbuild/project.py", line 479, in setup
self.apply_user_defaults(tool)
File "project.py", line 62, in apply_user_defaults
super().apply_user_defaults(tool)
File "/private/var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/pip-build-env-6w6xra03/overlay/lib/python3.8/site-packages/pyqtbuild/project.py", line 70, in apply_user_defaults
super().apply_user_defaults(tool)
File "/private/var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/pip-build-env-6w6xra03/overlay/lib/python3.8/site-packages/sipbuild/project.py", line 225, in apply_user_defaults
self.builder.apply_user_defaults(tool)
File "/private/var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/pip-build-env-6w6xra03/overlay/lib/python3.8/site-packages/pyqtbuild/builder.py", line 66, in apply_user_defaults
raise PyProjectOptionException('qmake',
sipbuild.pyproject.PyProjectOptionException
----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/4d/81/b9a66a28fb9a7bbeb60e266f06ebc4703e7e42b99e3609bf1b58ddd232b9/PyQt5-5.14.2.tar.gz#sha256=bd230c6fd699eabf1ceb51e13a8b79b74c00a80272c622427b80141a22269eb0 (from https://pypi.org/simple/pyqt5/) (requires-python:>=3.5). Command errored out with exit status 1: /Applications/Xcode.app/Contents/Developer/usr/bin/python3 /Library/Python/3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py prepare_metadata_for_build_wheel /var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/tmp9oeqr7vm Check the logs for full command output.
Using cached PyQt5-5.14.1.tar.gz (3.2 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... error
ERROR: Command errored out with exit status 1:
command: /Applications/Xcode.app/Contents/Developer/usr/bin/python3 /Library/Python/3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py prepare_metadata_for_build_wheel /var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/tmpgyk62cud
cwd: /private/var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/pip-install-bv0c7yxz/pyqt5_561782674bb34431a57220b8c2e76631
Complete output (31 lines):
Traceback (most recent call last):
File "/Library/Python/3.8/site-packages/pip/_vendor/pep517/in_process/_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 "/Library/Python/3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 280, in <module>
main()
File "/Library/Python/3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 263, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/Library/Python/3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 130, in prepare_metadata_for_build_wheel
return _get_wheel_metadata_from_wheel(backend, metadata_directory,
File "/Library/Python/3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 159, in _get_wheel_metadata_from_wheel
whl_basename = backend.build_wheel(metadata_directory, config_settings)
File "/private/var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/pip-build-env-bdif8fjh/overlay/lib/python3.8/site-packages/sipbuild/api.py", line 51, in build_wheel
project = AbstractProject.bootstrap('pep517')
File "/private/var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/pip-build-env-bdif8fjh/overlay/lib/python3.8/site-packages/sipbuild/abstract_project.py", line 83, in bootstrap
project.setup(pyproject, tool, tool_description)
File "/private/var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/pip-build-env-bdif8fjh/overlay/lib/python3.8/site-packages/sipbuild/project.py", line 479, in setup
self.apply_user_defaults(tool)
File "project.py", line 62, in apply_user_defaults
super().apply_user_defaults(tool)
File "/private/var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/pip-build-env-bdif8fjh/overlay/lib/python3.8/site-packages/pyqtbuild/project.py", line 70, in apply_user_defaults
super().apply_user_defaults(tool)
File "/private/var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/pip-build-env-bdif8fjh/overlay/lib/python3.8/site-packages/sipbuild/project.py", line 225, in apply_user_defaults
self.builder.apply_user_defaults(tool)
File "/private/var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/pip-build-env-bdif8fjh/overlay/lib/python3.8/site-packages/pyqtbuild/builder.py", line 66, in apply_user_defaults
raise PyProjectOptionException('qmake',
sipbuild.pyproject.PyProjectOptionException
----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/3a/fb/eb51731f2dc7c22d8e1a63ba88fb702727b324c6352183a32f27f73b8116/PyQt5-5.14.1.tar.gz#sha256=2f230f2dbd767099de7a0cb915abdf0cbc3256a0b5bb910eb09b99117db7a65b (from https://pypi.org/simple/pyqt5/) (requires-python:>=3.5). Command errored out with exit status 1: /Applications/Xcode.app/Contents/Developer/usr/bin/python3 /Library/Python/3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py prepare_metadata_for_build_wheel /var/folders/kk/ck6hb36n5z1373zlhm46l3m80000gn/T/tmpgyk62cud Check the logs for full command output.
Using cached PyQt5-5.14.0.tar.gz (3.2 MB)
ERROR: pyqt5 from https://files.pythonhosted.org/packages/7c/5b/e760ec4f868cb77cee45b4554bf15d3fe6972176e89c4e3faac941213694/PyQt5-5.14.0.tar.gz#sha256=0145a6b7de15756366decb736c349a0cb510d706c83fda5b8cd9e0557bc1da72 has a pyproject.toml file that does not comply with PEP 518: 'build-system.requires' contains an invalid requirement: 'sip >=5.0.1 <6'
jett@jmac ~ % 

您使用的是M1 Mac吗?如果是这样的话,这对我来说很有效:我如何用M1芯片在mac上运行pyqt5

如果该页面被删除,有人需要这个:

  1. 右键单击Finder中的终端应用程序,然后单击复制
  2. 重命名其中一个,以便您知道哪个是哪个
  3. 右键单击重命名的,然后单击";获取信息";。选中选项";使用罗塞塔打开">
  4. 打开Rosetta版本,创建一个虚拟Python环境。/usr/bin/python3 -m venv env
  5. 激活环境。source env/bin/activate
  6. 升级pippip install --upgrade pip
  7. 安装PyQt5pip install PyQt5

这在运行Big Sur的M1 Air上对我有效,我不能说它在英特尔Mac上是否有帮助。

Mike Simone的

回答对我有效,但第7步除外,该步骤使用pyqt5失败,但使用pyqt6成功。

pyqt6是为ARM安装的,如下面的输出所示。

在代码中,只需将导入更改为PyQt6即可。存在一些细微的代码差异。

(venv) username@MacPunch pushbutton % pip install PyQt6
Collecting PyQt6
Downloading PyQt6-6.4.0-cp37-abi3-macosx_10_14_universal2.whl (11.6 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 11.6/11.6 MB 3.2 MB/s eta 0:00:00
Collecting PyQt6-Qt6>=6.4.0
Downloading PyQt6_Qt6-6.4.1-py3-none-macosx_11_0_arm64.whl (38.0 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 38.0/38.0 MB 2.5 MB/s eta 0:00:00
Collecting PyQt6-sip<14,>=13.4
Downloading PyQt6_sip-13.4.0.tar.gz (111 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 111.2/111.2 kB 2.2 MB/s eta 0:00:00
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: PyQt6-sip
Building wheel for PyQt6-sip (pyproject.toml) ... done
Created wheel for PyQt6-sip: filename=PyQt6_sip-13.4.0-cp38-cp38-macosx_10_14_arm64.whl size=132021 sha256=871d16c4c852b49b9d4859ece2d516a4e650fe10a0024f9bf7105773b5ad0be9
Stored in directory: /Users/username/Library/Caches/pip/wheels/98/43/59/58c7e4bf0439947e465446a8948e84910729052c76131272e8
Successfully built PyQt6-sip
Installing collected packages: PyQt6-Qt6, PyQt6-sip, PyQt6
Successfully installed PyQt6-6.4.0 PyQt6-Qt6-6.4.1 PyQt6-sip-13.4.0
(venv) username@MacPunch pushbutton %  

选择的答案几乎说明了一切,它也解决了我的问题。顺便说一句,虚拟环境必须从位于/usr/bin/python3的系统python创建,其他python无法工作。

相关内容

  • 没有找到相关文章

最新更新