我正在尝试安装pyqt5
使用带有 M1 芯片和 Python 3.9.12 的 mac 操作系统。我怀疑M1芯片可能是原因。
我收到一个错误metadata-generation-failed
.
最小工作示例
# directly in the terminal
pip install --no-cache-dir PyQt5==5.14.1
或者将下面的行添加到requirements.txt
# necessary for jupyter-notebook so added to requirements.txt
# then run: pip install -r requirements.txt
pyqt5==5.14.1 # missing in conda-forge
我的尝试
我也尝试使用下面的解决方案,但没有成功。 Homebrew 还声称安装了 pyqt,这很奇怪。
pip install pyqt5
brew install pyqt5
- 将其添加到
requirements.txt
然后运行pip install -r requirements.txt
相关问题:
- AttributeError:模块“sipbuild.api”没有 PyQt5 5.15.0 的属性“prepare_metadata_for_build_wheel” https://stackoverflow.com/questions/65447314/attributeerror-module-sipbuild-api-has-no-attribute-prepare-metadata-for-bui
这可能确实是 M1 问题。
我认为这与你的问题类似:我如何在带有 M1 芯片的 Mac 上运行 pyqt5 https://stackoverflow.com/questions/65901162/how-can-i-run-pyqt5-on-my-mac-with-m1chip
但从源代码构建 PyQt5 包可能是更好的解决方案:从源代码构建 PyQt5 https://www.riverbankcomputing.com/static/Docs/PyQt5/installation.html#building-and-installing-from-source
我还发现有人在 M1 Mac 上构建并安装 PyQt6 的脚本:在 M1 上构建 PyQt6 https://gist.github.com/jinwoo1225/a6bef23bdacb4dee6fbfe50301f2f670。
可以更改此脚本来构建 PyQt5。
编辑:考虑使用 PyQt6 (pip install PyQt6
)。它已经在 pypi 上有了一个 universal2 版本。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)