← 返回命令列表

Linux command

poetry 命令

文本

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

常用示例

Create new project

poetry new [project-name]

Initialize in existing directory

poetry init

Install dependencies

poetry install

Add a package

poetry add [package]

Remove a package

poetry remove [package]

Run a command

poetry run [command]

Activate virtual environment

poetry shell

说明

poetry is a Python dependency management and packaging tool that uses pyproject.toml as its single configuration file. It handles dependency resolution, virtual environment management, building, and publishing packages to PyPI. Poetry creates isolated virtual environments for each project and uses a lock file (poetry.lock) to ensure reproducible installations across different machines. Key commands include install (install dependencies), add/remove (manage dependencies), run (execute in venv), and shell (activate venv).

参数

new _NAME_
Create new project.
init
Initialize interactively.
install
Install dependencies.
add _PKG_
Add dependency.
remove _PKG_
Remove dependency.
run _CMD_
Run command in venv.
shell
Spawn shell in venv.
update
Update dependencies.

FAQ

What is the poetry command used for?

poetry is a Python dependency management and packaging tool that uses pyproject.toml as its single configuration file. It handles dependency resolution, virtual environment management, building, and publishing packages to PyPI. Poetry creates isolated virtual environments for each project and uses a lock file (poetry.lock) to ensure reproducible installations across different machines. Key commands include install (install dependencies), add/remove (manage dependencies), run (execute in venv), and shell (activate venv).

How do I run a basic poetry example?

Run `poetry new [project-name]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does new _NAME_ do in poetry?

Create new project.