擅长:python、mysql、java
<p>在我看来<code>requirements.txt</code>文件应该列出所有依赖项、直接依赖项以及它们的依赖项(间接的、暂时的)。如果出于某种原因,只需要直接依赖项,那么有一些工具可以帮助实现这一点,从粗略的角度来看,<em>pipchill</em>似乎不够,因为它实际上没有查看代码来确定直接导入了哪些包。也许最好看看像<a href="https://pypi.org/project/pipreqs/" rel="nofollow noreferrer">pipreqs</a>、<a href="https://pypi.org/project/pigar/" rel="nofollow noreferrer">pigar</a>这样的项目,它们在计算实际的直接依赖关系时似乎更准确(基于代码中的导入)</p>
<p>但是在一天结束的时候,你应该手工整理这些清单。在编写代码时,您要仔细选择要导入的包,同样要小心地整理包含这些包的项目(及其版本)列表。工具可以提供帮助,但开发人员更清楚</p>