我有一个和AttributeError: module 'sipbuild.api' has no attribute 'prepare_metadata_for_build_wheel' for PyQt5 5.15.0类似的问题,那里提出的解决方案大多是安装最新版本的pip,但是我有最新的pip版本(22.0.2),它仍然不工作,我正在尝试安装在MacOS 12.1,python版本3.8.9。
命令输出:
Collecting PyQt5
Using cached PyQt5-5.15.6.tar.gz (3.2 MB)
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
╰─> [29 lines of output]
Traceback (most recent call last):
File "/Users/ashuadhikari/Library/Python/3.8/lib/python/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 "/Users/ashuadhikari/Library/Python/3.8/lib/python/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
main()
File "/Users/ashuadhikari/Library/Python/3.8/lib/python/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/Users/ashuadhikari/Library/Python/3.8/lib/python/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/2_/r0h48ntn7x9dz67r08nh7rv80000gn/T/pip-build-env-tp6yyadf/overlay/lib/python3.8/site-packages/sipbuild/api.py", line 51, in build_wheel
project = AbstractProject.bootstrap('pep517')
File "/private/var/folders/2_/r0h48ntn7x9dz67r08nh7rv80000gn/T/pip-build-env-tp6yyadf/overlay/lib/python3.8/site-packages/sipbuild/abstract_project.py", line 83, in bootstrap
project.setup(pyproject, tool, tool_description)
File "/private/var/folders/2_/r0h48ntn7x9dz67r08nh7rv80000gn/T/pip-build-env-tp6yyadf/overlay/lib/python3.8/site-packages/sipbuild/project.py", line 587, 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/2_/r0h48ntn7x9dz67r08nh7rv80000gn/T/pip-build-env-tp6yyadf/overlay/lib/python3.8/site-packages/pyqtbuild/project.py", line 70, in apply_user_defaults
super().apply_user_defaults(tool)
File "/private/var/folders/2_/r0h48ntn7x9dz67r08nh7rv80000gn/T/pip-build-env-tp6yyadf/overlay/lib/python3.8/site-packages/sipbuild/project.py", line 234, in apply_user_defaults
self.builder.apply_user_defaults(tool)
File "/private/var/folders/2_/r0h48ntn7x9dz67r08nh7rv80000gn/T/pip-build-env-tp6yyadf/overlay/lib/python3.8/site-packages/pyqtbuild/builder.py", line 67, 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.
注意:用brew安装PyQt5可以,但是brew安装了最新的python版本作为依赖项,我想在我的venv中安装PyQt5。
3条答案
按热度按时间2ic8powd1#
我在M1 Mac上安装PyQt5时也遇到了问题,但如果你想使用没有miniconda的venv,我找到了另一种选择。使用brew安装python并不能修复在venv中安装PyQt5时出现的pip错误。
这个bug实际上似乎与Python通用安装程序的使用有关,而且PyQt5 5.15.6似乎还有另一个bug。
第一个:安装Python 3.9.13 MacOS仅限Intel的安装程序从python.org安装完成后,我尝试使用pip在venv中安装最新版本的PyQt(5.15.6),但pip标记了一个哈希不匹配:
所以第二个:使用管道安装PyQt5==5.15.5
这成功地允许我在PyQt5中正常使用venv。
uurv41yg2#
所以人们可以在评论之外找到这个答案:
在macOS上使用Brew是可行的,从那里安装Python和PyQT5,如果希望它正常工作,请确保将python命令更改为Brew的目录。
我不知道为什么,但
pip
目前在macOS(可能是所有平台)上从www.example.com安装时出现故障python.orgicnyk63a3#
示例:
main.py:
untitled.ui:
并将你的用户界面代码保存在untitled.ui文件中(不要运行用户界面文件格式.py);D级