← 返回命令列表

Linux command

poetry-shell 命令

文本

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

常用示例

Activate the project's virtual environment

poetry shell

Exit

exit

Install the plugin

poetry self add poetry-plugin-shell

Modern alternative

eval $(poetry env activate)

说明

poetry shell spawns a new shell session with the project's virtual environment activated. All commands run within this shell will use the project's Python interpreter and installed packages. Type exit or press Ctrl+D to leave the virtual environment shell and return to the original session. The virtual environment is created automatically if it doesn't exist.

FAQ

What is the poetry-shell command used for?

poetry shell spawns a new shell session with the project's virtual environment activated. All commands run within this shell will use the project's Python interpreter and installed packages. Type exit or press Ctrl+D to leave the virtual environment shell and return to the original session. The virtual environment is created automatically if it doesn't exist.

How do I run a basic poetry-shell example?

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

Where can I find more poetry-shell examples?

This page includes 4 examples for poetry-shell, plus related commands for nearby Linux tasks.