← 返回命令列表

Linux command

poetry-lock 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Generate lock file

poetry lock

Update lock without installing

poetry lock --no-update

Check if lock is current

poetry lock --check

说明

poetry lock resolves all dependencies defined in pyproject.toml and writes the exact resolved versions to poetry.lock. This lock file ensures that every installation uses identical package versions for reproducible builds. The --no-update flag regenerates the lock file format without updating dependency versions. The --check flag verifies that the existing lock file is consistent with pyproject.toml without modifying anything. Note that this command only updates the lock file; run poetry install afterward to actually install packages.

参数

--no-update
Don't update dependencies.
--check
Verify lock file is up-to-date.

FAQ

What is the poetry-lock command used for?

poetry lock resolves all dependencies defined in pyproject.toml and writes the exact resolved versions to poetry.lock. This lock file ensures that every installation uses identical package versions for reproducible builds. The --no-update flag regenerates the lock file format without updating dependency versions. The --check flag verifies that the existing lock file is consistent with pyproject.toml without modifying anything. Note that this command only updates the lock file; run poetry install afterward to actually install packages.

How do I run a basic poetry-lock example?

Run `poetry lock` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --no-update do in poetry-lock?

Don't update dependencies.