作者:佚名 时间:2024-02-27 10:13:46 阅读:(268)
在使用Python时,当遇到"pyproject.toml: line 7: using '[tool.sip.metadata]' to specify the project metadata is deprecated and will be removed in SIP v7.0.0, use '[project]' instead"错误时,这意味着您在项目的pyproject.toml文件中使用了过时的配置方式。根据错误提示,建议您使用新的配置方式来指定项目元数据。
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 ╰─> [26 lines of output] pyproject.toml: line 7: using '[tool.sip.metadata]' to specify the project metadata is deprecated and will be removed in SIP v7.0.0, use '[project]' instead Traceback (most recent call last): File "E:\Python\venv\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, inmain() File "E:\Python\venv\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main json_out['return_val'] = hook(**hook_input['kwargs']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\Python\venv\Lib\site-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 "C:\Users\lenovo\AppData\Local\Temp\pip-build-env-9kw63mdv\overlay\Lib\site-packages\sipbuild\api.py", line 46, in build_wheel project = AbstractProject.bootstrap('wheel', ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\lenovo\AppData\Local\Temp\pip-build-env-9kw63mdv\overlay\Lib\site-packages\sipbuild\abstract_project.py", line 92, in bootstrap project.setup(pyproject, tool, tool_description) File "C:\Users\lenovo\AppData\Local\Temp\pip-build-env-9kw63mdv\overlay\Lib\site-packages\sipbuild\project.py", line 587, in setup self.apply_user_defaults(tool) File "C:\Users\lenovo\AppData\Local\Temp\pip-install-893e8p97\pyqt5_0bc8f7f9cbc9489587a106272c085f21\project.py", line 63, in apply_user_defaults super().apply_user_defaults(tool) File "C:\Users\lenovo\AppData\Local\Temp\pip-build-env-9kw63mdv\overlay\Lib\site-packages\pyqtbuild\project.py", line 70, in apply_user_defaults super().apply_user_defaults(tool) File "C:\Users\lenovo\AppData\Local\Temp\pip-build-env-9kw63mdv\overlay\Lib\site-packages\sipbuild\project.py", line 237, in apply_user_defaults self.builder.apply_user_defaults(tool) File "C:\Users\lenovo\AppData\Local\Temp\pip-build-env-9kw63mdv\overlay\Lib\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. hint: See above for details.
1、打开项目的pyproject.toml文件,定位到第7行。
2、将"[tool.sip.metadata]"替换为"[project]"。
3、保存并关闭文件。
PS:pyproject.toml 文件通常位于您的 Python 项目的根目录下。如果您无法找到 pyproject.toml 文件,可以尝试使用文件管理器或者命令行工具在项目目录中搜索这个文件。
通过使用"[project]"来指定项目元数据,您将使用最新的配置方式,以适应SIP v7.0.0及更高版本的要求。希望以上方法能够帮助您解决问题!