Linux command
poetry-run 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Run command in virtual environment
poetry run [command]
Run Python script
poetry run python [script.py]
Run installed tool
poetry run pytest
Run with arguments
poetry run python -m [module] [args]
说明
poetry run executes a command within the project's virtual environment without requiring manual activation. It automatically locates and uses the correct virtual environment for the current project. This is the recommended way to run project scripts, test suites, and installed tools. For example, `poetry run pytest` runs tests using the project's dependencies, and `poetry run python script.py` executes a script with the project's Python interpreter. An alternative is poetry shell for an interactive session.
FAQ
What is the poetry-run command used for?
poetry run executes a command within the project's virtual environment without requiring manual activation. It automatically locates and uses the correct virtual environment for the current project. This is the recommended way to run project scripts, test suites, and installed tools. For example, `poetry run pytest` runs tests using the project's dependencies, and `poetry run python script.py` executes a script with the project's Python interpreter. An alternative is poetry shell for an interactive session.
How do I run a basic poetry-run example?
Run `poetry run [command]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
Where can I find more poetry-run examples?
This page includes 4 examples for poetry-run, plus related commands for nearby Linux tasks.