![](/img/trans.png)
[英]Error installing pyQt5: error: metadata-generation-failed
[英]`pyqt5' error `metadata-generation-failed`
我正在嘗試使用帶有 M1 芯片的 mac OS 和 Python 3.9.12 安裝pyqt5
。 我懷疑 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
相關問題:
出於故障排除目的,您可以運行:
# Make sure python3 points to your Python 3.9.12
python3 -m venv /tmp/venv
source /tmp/venv/bin/activate
pip install --no-cache-dir PyQt5==5.14.1
# If last step fails and complains about `pip` version, upgrade `pip` and try `pip install ..` again
如果 PyQt5 安裝成功,那么你確定不是 M1 芯片的問題。 然后你可以嘗試:
python3 -m pip install --no-cache-dir PyQt5==5.14.1
也許您可以嘗試添加此命令?
--use-deprecated=backtrack-on-build-failures
您可以嘗試在安裝命令后面添加它,例如
pip install pyqt5 --use-deprecated=backtrack-on-build-failures
這可能真的是一個 M1 問題。 我認為這與您的問題相似: 如何在我的帶有 M1chip 的 Mac 上運行 pyqt5
但從源代碼構建 PyQt5 package 可能是更好的解決方案: Building PyQt5 from Source
我還發現有人在 M1 Mac 上構建和安裝 PyQt6 的腳本: Build PyQt6 on M1 。 可以更改此腳本以構建 PyQt5。
編輯:考慮使用 PyQt6 ( pip install PyQt6
)。 它已經在 pypi 上構建了一個universal2。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.