您可以尝试使用pipdeptree将依赖项显示为树结构,例如:
$ pipdeptree
Lookupy==0.1
wsgiref==0.1.2
argparse==1.2.1
psycopg2==2.5.2
Flask-Script==0.6.6
- Flask [installed: 0.10.1]
- Werkzeug [required: >=0.7, installed: 0.9.4]
- Jinja2 [required: >=2.4, installed: 2.7.2]
- MarkupSafe [installed: 0.18]
- itsdangerous [required: >=0.21, installed: 0.23]
alembic==0.6.2
- SQLAlchemy [required: >=0.7.3, installed: 0.9.1]
- Mako [installed: 0.9.1]
- MarkupSafe [required: >=0.9.2, installed: 0.18]
ipython==2.0.0
slugify==0.0.1
redis==2.9.1
要运行它:
pip install pipdeptree
编辑:正如@Esteban在评论中指出的那样,您还可以反向列出树(带有-r
或与单个包相对),-p <package_name>
以查找可以运行的已安装Werkzeug:
$ pipdeptree -r -p Werkzeug
Werkzeug==0.11.15
- Flask==0.12 [requires: Werkzeug>=0.7]
pipdeptree -r
“以相反的方式显示依赖关系树,即子依赖关系与需要它们的软件包列表一起列出。”