为什么pip安装在需求文件中失败,即使其中一个在python django中失败

时间:2021-05-06 20:24:34

I am using pip to install packages from requirements file

我正在使用pip从需求文件安装包

pip install -r requirements.txt

pip install -r requirements.txt

I have seen that if I have 50 packages in the text file and and last one fails then pip does not install any of the above 49 package and fails.

我已经看到,如果我在文本文件中有50个包,并且最后一个失败,那么pip不会安装任何上述49个包并且失败。

I have to repeat the whole step and it spends more time downloading all of them again.

我必须重复整个步骤,花更多的时间再次下载所有这些。

Is this the expected behavior? Why does it not just install the 49 packages that it is able to?

这是预期的行为吗?为什么它不只是安装它能够的49个包?

1 个解决方案

#1


1  

I guess just as pip install --help says, the -r option:

我猜就像pip install --help说的那样,-r选项:

Install all the packages listed in the given
                        requirements file.

Thus when any of the requirement fails, it's better for pip to exist w/ status 1 and roll back other package installations, just as a transaction.

因此,当任何需求失败时,最好是pip以状态1存在并回滚其他包安装,就像事务一样。

You could pip install --no-download -r requirements.txt after fixing errors in the requirement file w/o downloading other packages again, since they are already downloaded and just stay there because of the unsuccessful installation.

您可以在修复需求文件中的错误后再次下载其他软件包,因为它们已经下载并且由于安装不成功而停留在那里,因此可以pip install --no-download -r requirements.txt。

#1


1  

I guess just as pip install --help says, the -r option:

我猜就像pip install --help说的那样,-r选项:

Install all the packages listed in the given
                        requirements file.

Thus when any of the requirement fails, it's better for pip to exist w/ status 1 and roll back other package installations, just as a transaction.

因此,当任何需求失败时,最好是pip以状态1存在并回滚其他包安装,就像事务一样。

You could pip install --no-download -r requirements.txt after fixing errors in the requirement file w/o downloading other packages again, since they are already downloaded and just stay there because of the unsuccessful installation.

您可以在修复需求文件中的错误后再次下载其他软件包,因为它们已经下载并且由于安装不成功而停留在那里,因此可以pip install --no-download -r requirements.txt。