使用Requirements.txt安装时,避免在单个软件包上出现故障 [英] 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
是唯一无法安装的软件包,这会导致一切失败(larsk在注释中指出了预期的结果).但是,在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安装时,避免在单个软件包上出现故障的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!