使用Requirements.txt安装时,避免在单个软件包上出现故障 [英] Stop pip from failing on single package when installing with requirements.txt

查看:123
本文介绍了使用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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆