AttributeError: module ‘sipbuild.api‘ has no attribute ‘prepare_metadata_for_build_wheel‘

Posted ldc_1257309054

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了AttributeError: module ‘sipbuild.api‘ has no attribute ‘prepare_metadata_for_build_wheel‘相关的知识,希望对你有一定的参考价值。


在Ubuntu中安装pyqt5时报这个错误

错误如下:

Collecting pyqt5
Downloading PyQt5-5.15.6.tar.gz (3.2 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.2/3.2 MB 44.6 kB/s eta 0:00:00
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
╰─> [35 lines of output]
Querying qmake about your Qt installation...
/usr/bin/qmake -query
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-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 "/usr/local/lib/python3.7/dist-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
main()
File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
json_out[return_val] = hook(**hook_input[kwargs])
File "/usr/local/lib/python3.7/dist-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 "/tmp/pip-build-env-pdoinu53/overlay/lib/python3.7/site-packages/sipbuild/api.py", line 51, in build_wheel
project = AbstractProject.bootstrap(pep517)
File "/tmp/pip-build-env-pdoinu53/overlay/lib/python3.7/site-packages/sipbuild/abstract_project.py", line 83, in bootstrap
project.setup(pyproject, tool, tool_description)
File "/tmp/pip-build-env-pdoinu53/overlay/lib/python3.7/site-packages/sipbuild/project.py", line 594, in setup
self.apply_user_defaults(tool)
File "project.py", line 63, in apply_user_defaults
super().apply_user_defaults(tool)
File "/tmp/pip-build-env-pdoinu53/overlay/lib/python3.7/site-packages/pyqtbuild/project.py", line 70, in apply_user_defaults
super().apply_user_defaults(tool)
File "/tmp/pip-build-env-pdoinu53/overlay/lib/python3.7/site-packages/sipbuild/project.py", line 241, in apply_user_defaults
self.builder.apply_user_defaults(tool)
File "/tmp/pip-build-env-pdoinu53/overlay/lib/python3.7/site-packages/pyqtbuild/builder.py", line 76, in apply_user_defaults
self._get_qt_configuration()
File "/tmp/pip-build-env-pdoinu53/overlay/lib/python3.7/site-packages/pyqtbuild/builder.py", line 495, in _get_qt_configuration
for line in project.read_command_pipe([self.qmake, -query]):
File "/tmp/pip-build-env-pdoinu53/overlay/lib/python3.7/site-packages/sipbuild/project.py", line 558, in read_command_pipe
"0 failed returning 1".format(cmd, pipe.returncode))
sipbuild.exceptions.UserException
[end of output]

解决方案

先安装​​pyqt5​​依赖项:

1、更新python3.7

sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get upgrade
sudo apt-get autoremove
sudo apt-get install python3.7
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 2
sudo update-alternatives --config python3
sudo apt-get install python3.7-dev
sudo apt-get install libhdf5-dev

2、更新pip3:

sudo python3 -m pip install --upgrade pip

3、安装pyqt5的依赖项

sudo apt install pyqt5*
sudo apt install qt5-default qttools5-dev-tools

4、最后再安装pyqt5

sudo pip3 install pyqt5
sudo pip3 install pyqt5-tools



以上是关于AttributeError: module ‘sipbuild.api‘ has no attribute ‘prepare_metadata_for_build_wheel‘的主要内容,如果未能解决你的问题,请参考以下文章

AttributeError:模块 'urllib' 没有属性 'parse'

tensorflow -----AttributeError: module ‘tensorflo

新的 Kivy 安装:AttributeError: 'module' 对象没有属性 'require'

类 InstagramSpider(scrapy.Spider): AttributeError: 'module' 对象没有属性 'Spider'

api = twitter.Api() AttributeError: 'module' 对象没有属性 'Api

安装pytest-allure-adaptor后,运行报错:AttributeError: module 'pytest' has no attribute 'allure&#