警告:锁定文件未与 pyproject.toml 中的最新更改保持同步

Warning: The lock file is not up to date with the latest changes in pyproject.toml

当我在 Python 3.7 中使用诗歌命令时,在我的例子中:

poetry export -f requirements.txt

我收到以下错误:

Warning: The lock file is not up to date with the latest changes in pyproject.toml. You may be getting outdated dependencies. Run update to update them.

到目前为止很清楚,但是如果我 运行 诗歌更新它会升级我的依赖项,这不是我现在想要的项目。如果我 运行 诗歌锁代替,它仍然会升级依赖项。

我该如何解决这个问题?

这是一首著名的issue诗词。

问题已解决,使用:poetry lock --no-update.

旧答案:

当前有一个使用以下命令的解决方法:

poetry add pathlib2
poetry remove pathlib2

其中 pathlib2 是 任何 库,你 还没有依赖 并且它本身没有依赖性,因此 pathlib2.

使用这些命令将重写锁定文件哈希并解决文件冲突,而无需升级项目中使用的任何其他包。