我尝试安装PyQt5==5.15.6,这个错误反复显示:
收集PyQt5==5.15.6 (from -r requirements.txt(第6行))使用缓存https://files.pythonhosted.org/packages/3b/27/fd81188a35f37be9b3b4c2db1654d9439d1418823916fe702ac3658c9c41/PyQt5-5.15.6.tar.gz安装构建依赖…完成获得建造车轮的要求……完成准备车轮元数据…错误命令输出错误,退出状态为1。命令:'c:usersclensappdatalocalprogramspythonpython38python python38python.exe' 'c:usersclensappdatalocalprogramspythonpython38libsite-packagespip_vendorpep517_in_process.py' prepare_metadata_for_build_wheel 'c:usersclensappdatalocal Temptmpf4m7pu7d'鹿:C:UsersclensAppDataLocalTemp pip -安装- 71 rwmvce PyQt5完整输出(31行):回溯(最近一次调用):文件"c:usersclensappdatalocalprogramspythonpython38libsite-packagespip_vendorpep517_in_process.py",第64行,在prepare_metadata_for_build_wheel钩子= backend.prepare_metadata_for_build_wheelAttributeError: module 'sipbuild。Api '没有属性'prepare_metadata_for_build_wheel'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:usersclensappdatalocalprogramspythonpython38libsite-packagespip_vendorpep517_in_process.py", line 207, in <module>
main()
File "c:usersclensappdatalocalprogramspythonpython38libsite-packagespip_vendorpep517_in_process.py", line 197, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "c:usersclensappdatalocalprogramspythonpython38libsite-packagespip_vendorpep517_in_process.py", line 66, in prepare_metadata_for_build_wheel
return _get_wheel_metadata_from_wheel(backend, metadata_directory,
File "c:usersclensappdatalocalprogramspythonpython38libsite-packagespip_vendorpep517_in_process.py", line 95, in _get_wheel_metadata_from_wheel
whl_basename = backend.build_wheel(metadata_directory, config_settings)
File "C:UsersclensAppDataLocalTemppip-build-env-12b0td49overlayLibsite-packagessipbuildapi.py", line 46, in build_wheel
project = AbstractProject.bootstrap('wheel',
File "C:UsersclensAppDataLocalTemppip-build-env-12b0td49overlayLibsite-packagessipbuildabstract_project.py", line 87, in bootstrap
project.setup(pyproject, tool, tool_description)
File "C:UsersclensAppDataLocalTemppip-build-env-12b0td49overlayLibsite-packagessipbuildproject.py", line 585, in setup
self.apply_user_defaults(tool)
File "project.py", line 63, in apply_user_defaults
super().apply_user_defaults(tool)
File "C:UsersclensAppDataLocalTemppip-build-env-12b0td49overlayLibsite-packagespyqtbuildproject.py", line 70, in apply_user_defaults
super().apply_user_defaults(tool)
File "C:UsersclensAppDataLocalTemppip-build-env-12b0td49overlayLibsite-packagessipbuildproject.py", line 236, in apply_user_defaults
self.builder.apply_user_defaults(tool)
File "C:UsersclensAppDataLocalTemppip-build-env-12b0td49overlayLibsite-packagespyqtbuildbuilder.py", line 69, in apply_user_defaults
raise PyProjectOptionException('qmake',
sipbuild.pyproject.PyProjectOptionException
----------------------------------------
ERROR: Command ERROR out with exit status 1: 'c:usersclensappdatalocalprogramspythonpython38python.exe' 'c:usersclensappdatalocalprogramspythonpython38libsite-packagespip_vendorpep517_in_process.py' prepare_metadata_for_build_wheel 'c:usersclensappdatalocal Temptmpf4m7pu7d'查看日志查看完整的命令输出。
我试图用命令pip install -r requirements.txt安装需求文件,但这个错误一直出现
我遇到了同样的问题,最终通过简单地降级到Python 3.9.13使其工作。它还不能在Python 3.11中实现。在以前的线程中没有建议的答案对我有效(升级pip或指定任何pyqt版本)。
降级Python,
- 安装虚拟环境(pip Install virtualenv)
- 在官方网站下载以前的Python版本(不要添加到路径中!)
- 使用新安装的Python版本创建一个虚拟环境:virtualenv pathtovirtualenv -p pathtonew Python .exe
- 激活virtualenv: pathtovirtualenvScriptsActivate
然后,用pip重新安装pyqt5和pyqt5-tools(在这个活动虚拟环境中),它应该可以工作了。