Pip安装但跳过设置.py如果已经退出

2024-04-19 18:58:35 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个脚本,它运行pip install -r requirements.txt -t folder,并在“folder”中为我执行脚本。在

每次我运行它时,pip install就会运行,收集所有的包并安装它们设置.py. 看起来它不会对已经存在的和最新的包进行任何更改,但是仍然需要一段时间来收集和运行它们设置.py为每一个。通常我不会修改软件包。在

我怎么让它跳过那些已经存在的?除了不每次运行pip安装之外,有没有一种方法可以加快速度?在


Tags: installpip方法pytxt脚本folderrequirements
1条回答
网友
1楼 · 发布于 2024-04-19 18:58:35

你可以看看:

-I, ignore-installed Ignore the installed packages (reinstalling instead).

或者

upgrade-strategy Determines how dependency upgrading should be handled [default: only-if-needed]. "eager" - dependencies are upgraded regardless of whether the currently installed version satisfies the requirements of the upgraded package(s). "only-if-needed" - are upgraded only when they do not satisfy the requirements of the upgraded package(s).

从来没想过这个问题,但是 https://pip.pypa.io/en/stable/man/commands/install/?highlight= ignore-installed 可能对你有帮助。在

或者你可以做一个预先设置的脚本来检查一下。在

相关问题 更多 >