使用 requirements.txt 安装时,阻止 pip 在单个包上失败 [英] Stop pip from failing on single package when installing with requirements.txt
问题描述
我正在从 requirements.txt
pip install -r requirements.txt
requirements.txt
文件内容如下:
Pillow
lxml
cssselect
jieba
beautifulsoup
nltk
lxml
是唯一一个安装失败的包,这会导致一切失败(如 larsks 在评论中指出的预期结果).但是,在 lxml
失败后 pip
仍然运行并下载其余的包.
lxml
is the only package failing to install and this leads to everything failing (expected results as pointed out by larsks in the comments). However, after lxml
fails pip
still runs through and downloads the rest of the packages.
据我所知,如果 requirements.txt
中列出的任何软件包无法安装,pip install -r requirements.txt
命令将失败.
From what I understand the pip install -r requirements.txt
command will fail if any of the packages listed in the requirements.txt
fail to install.
在运行 pip install -r requirements.txt
时,我是否可以传递任何参数来告诉它安装它可以安装的包并跳过它不能安装的包,或者在它看到时立即退出失败了?
Is there any argument I can pass when running pip install -r requirements.txt
to tell it to install what it can and skip the packages that it cannot, or to exit as soon as it sees something fail?
推荐答案
使用 pip install
运行每一行可能是一种解决方法.
Running each line with pip install
may be a workaround.
cat requirements.txt | xargs -n 1 pip install
注意:-a
参数在MacOS下不可用,所以老猫更便携.
Note: -a
parameter is not available under MacOS, so old cat is more portable.
这篇关于使用 requirements.txt 安装时,阻止 pip 在单个包上失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!