Linux command
poetry-export 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Export to requirements.txt
poetry export -f requirements.txt -o requirements.txt
Export with dev dependencies
poetry export --with dev -f requirements.txt
Export without hashes
poetry export --without-hashes -o requirements.txt
Export only specific dependency groups
poetry export --only [main,docs] -f requirements.txt
Export to standard output
poetry export -f requirements.txt
Export including extras
poetry export -f requirements.txt -E [extra_name]
说明
poetry export exports the lock file to other formats. It is provided by the poetry-plugin-export plugin. Primarily used to generate requirements.txt files for environments that don't use Poetry directly, such as Docker builds or production deployments.
参数
- -f, --format _format_
- Output format (requirements.txt, constraints.txt, pylock.toml).
- -o, --output _file_
- Output file path. If omitted, prints to standard output.
- --with _groups_
- Include optional dependency groups.
- --without _groups_
- Exclude dependency groups.
- --only _groups_
- Include only the specified dependency groups.
- --without-hashes
- Exclude hashes from output.
- --without-urls
- Exclude source URLs from output.
- -E, --extras _extras_
- Include extras.
FAQ
What is the poetry-export command used for?
poetry export exports the lock file to other formats. It is provided by the poetry-plugin-export plugin. Primarily used to generate requirements.txt files for environments that don't use Poetry directly, such as Docker builds or production deployments.
How do I run a basic poetry-export example?
Run `poetry export -f requirements.txt -o requirements.txt` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -f, --format _format_ do in poetry-export?
Output format (requirements.txt, constraints.txt, pylock.toml).