【问题标题】:Pip Install -r requirements.txt Without FailingPip 安装 -r requirements.txt 没有失败
【发布时间】:2019-08-27 14:13:20
【问题描述】:

我正在尝试使用pip install -r requirements.txt 安装来自requirements.txt 的所有依赖项。如果其中一个软件包已安装或找不到其中一个软件包,它通常会停止。

我怎样才能避免这种情况?即忽略导致错误的包并移至下一个。

另外,我正在使用来自conda 虚拟环境的pip freeze > requirements.txt 创建我的requirements.txt

requirements.txt:

attrs==19.1.0
backcall==0.1.0
bleach==3.1.0
certifi==2019.3.9
chardet==3.0.4
Click==7.0
cycler==0.10.0
DateTime==4.3
decorator==4.4.0
defusedxml==0.5.0
entrypoints==0.3
future==0.17.1
geocoder==1.38.1
geographiclib==1.49
geopy==1.19.0
idna==2.8
importlib-resources==1.0.2
ipykernel==5.1.0
ipython==7.4.0
ipython-genutils==0.2.0
ipywidgets==7.4.2
jedi==0.13.3
Jinja2==2.10
jsonschema==3.0.1
jupyter==1.0.0
jupyter-client==5.2.4
jupyter-console==6.0.0
jupyter-core==4.4.0
kiwisolver==1.0.1
MarkupSafe==1.1.1
matplotlib==3.0.3
mistune==0.8.4
mkl-fft==1.0.10
mkl-random==1.0.2
nbconvert==5.4.1
nbformat==4.4.0
notebook==5.7.6
numpy==1.16.2
pandas==0.24.2
pandocfilters==1.4.2
parso==0.3.4
patsy==0.5.1
pexpect==4.6.0
pickleshare==0.7.5
prometheus-client==0.6.0
prompt-toolkit==2.0.9
ptyprocess==0.6.0
Pygments==2.3.1
pyodbc==4.0.26
pyparsing==2.3.1
pyrsistent==0.14.11
python-dateutil==2.8.0
pytz==2018.9
pyzmq==18.0.0
qtconsole==4.4.3
ratelim==0.1.6
requests==2.21.0
scikit-learn==0.20.3
scipy==1.2.1
seaborn==0.9.0
Send2Trash==1.5.0
Shapely==1.6.4.post2
six==1.12.0
statsmodels==0.9.0
terminado==0.8.1
testpath==0.4.2
timezonefinder==4.0.1
tornado==6.0.2
traitlets==4.3.2
tzwhere==3.0.3
urllib3==1.24.1
wcwidth==0.1.7
webencodings==0.5.1
widgetsnbextension==3.4.2
zope.interface==4.6.0

错误:

找不到满足要求的版本 mkl-fft==1.0.10(来自 -r requirements.txt(第 33 行))(来自版本:) 没有找到 mkl-fft==1.0.10 的匹配分布(来自 -r requirements.txt(第 33 行))

提前非常感谢!

【问题讨论】:

    标签: python-3.x pip anaconda


    【解决方案1】:

    您应该使用--ignore-installed 标志https://pip.pypa.io/en/stable/reference/pip_install/#cmdoption-i
    如果您不想安装软件包,只需将其从 requirements.txt 中删除即可。或者试试这个。 Stop pip from failing on single package when installing with requirements.txt

    【讨论】:

    • 感谢您的参考链接。没有提到如果找不到包如何忽略。我该怎么做?
    • 这违反直觉。如果您不想安装软件包,只需将其从 requirements.txt 中删除即可。或者试试这个。 stackoverflow.com/questions/22250483/…
    • 谢谢。这非常有效。您想将该链接添加到您的答案中吗?然后我就可以接受了。
    • 我认为这仅解决了确实安装了软件包的情况,而不是未找到要求的情况(如问题示例所示)
    猜你喜欢
    • 2020-07-31
    • 1970-01-01
    • 2017-05-07
    • 2020-01-11
    • 2021-08-05
    • 2018-06-19
    • 2014-09-07
    • 2018-10-23
    • 2014-04-10
    相关资源
    最近更新 更多