一个命令行工具,用于显示已安装的 Python 包的依赖树。
pipdeptree 以依赖树的形式显示已安装的 Python 包。
pip freeze 显示的是扁平列表;而 pipdeptree 则增加了父子关系,
并报告依赖冲突或循环依赖。
pip install pipdeptree
pipdeptreeFlask==0.10.1
┣━━ ✓ itsdangerous required: >=0.21 installed: 0.24
┣━━ ✓ Jinja2 required: >=2.4 installed: 2.11.2
┃ ┗━━ ⚠ MarkupSafe required: >=0.23 installed: 0.22
┗━━ ✓ Werkzeug required: >=0.7 installed: 0.11.2查找需要某个依赖的包:
pipdeptree --reverse --packages markupsafe以 JSON、Mermaid 或 Graphviz 格式输出:
pipdeptree -o json
pipdeptree -o mermaid
pipdeptree -o graphviz-svg > deps.svg报告包数量、深度、冲突、循环、许可证和大小:
pipdeptree --summary # aligned text
pipdeptree --summary -o rich # styled table
pipdeptree --summary -o json # machine-readable在不安装的情况下检查依赖树。针对包索引解析需求,或离线读取已解析的 PEP 751 锁文件:
pipdeptree from-index "flask" # i is a shorthand alias
pipdeptree from-index --requirements requirements.txt
pipdeptree from-lock pylock.toml # l is a shorthand alias上述渲染标志(包括 --summary)对两个子命令均有效。
如需完整文档,请访问 pipdeptree.readthedocs.io。
暂无开放 Issues,或尚未同步最近议题。