我最近切換到 Apple Silicon,現在嘗試在requirements.txt. 但是,由于架構不同,我無法滿足所有要求,特別是子依賴項。
要求.txt
ethnicolr==0.8.1
# and many more, but this one is causing issues
用pip install -r requirements.txtyields安裝它
錯誤:找不到滿足 tensorflow==2.5.2 要求的版本(來自ethnicolr)(來自版本:無)
TensorFlow 2.4.0 可用于此設定,它應該與ethnicolr 一起使用。那么如何覆寫子依賴的版本requirements.txt呢?
順便說一句,我正在將 Mambaforge 用于虛擬環境。因為建議在 Apple M1 上運行 PyData Stack
uj5u.com熱心網友回復:
一種解決方法是顯式設定依賴項并pip install使用--no-deps引數運行。
將我的設定requirements.txt為:
ethnicolr==0.8.1
# and many more, but this one is causing issues
tensorflow==2.5.0 # You set this to whatever version you want to
我跑了:
> pip install --no-deps -r requirements.txt
Collecting ethnicolr==0.8.1
Using cached ethnicolr-0.8.1-py2.py3-none-any.whl (36.1 MB)
Collecting tensorflow==2.5.0
Using cached tensorflow-2.5.0-cp39-cp39-manylinux2010_x86_64.whl (454.4 MB)
Installing collected packages: tensorflow, ethnicolr
Successfully installed ethnicolr-0.8.1 tensorflow-2.5.0
這意味著一個明確的問題:您必須事先知道您的軟體包使用了哪些依賴項。要輕松找到這些,您可以使用pip-tools
uj5u.com熱心網友回復:
您應該安裝一個對 tensorflow 版本沒有特定要求的ethnicolr 版本。pip install ethnicolr==0.2.0可以作業。
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/391931.html
