使用 pipenv sync 比 pipenv install 有什么优势?

what are the advantages of using pipenv sync over pipenv install?

我正在使用 pipenv 来管理我的 python 包,在我的存储库中,我对 Pipfile 和 Pipfile.lock 进行了版本控制。我想在我的实时服务器上安装所有 python 包。我应该使用 pipenv sync 还是 pipenv install?为什么?

docs 来看,pipenv install 似乎将从 Pipfile 安装所有依赖项,并使用它使用的版本更新 Pipfile.lock。 pipenv sync 将安装 Pipfile.lock 中指定的确切版本。

我会说 sync 更适合让您的环境与签入的内容相匹配,而 install 适用于您想要获取最新版本或添加新的依赖项时尚未在锁定文件中。