获得pip中各个包的依赖关系

安装
$ pip install pipdeptree

运行得到结果
$ pipdeptree
adium-theme-ubuntu==0.3.4
decorator==4.0.6
ipython==2.4.1
meld==3.14.2
pexpect==4.0.1
pipdeptree==0.12.1
  - pip [required: >=6.0.0, installed: 10.0.1]
ptyprocess==0.5
pycurl==7.43.0
pygobject==3.20.0
pylint==1.8.4
  - astroid [required: >=1.6,<2.0, installed: 1.6.3]
    - backports.functools-lru-cache [required: Any, installed: 1.5]
    - enum34 [required: >=1.1.3, installed: 1.1.6]
    - lazy-object-proxy [required: Any, installed: 1.3.1]
    - singledispatch [required: Any, installed: 3.4.0.3]
      - six [required: Any, installed: 1.11.0]
    - six [required: Any, installed: 1.11.0]
    - wrapt [required: Any, installed: 1.10.11]
  - backports.functools-lru-cache [required: Any, installed: 1.5]
  - configparser [required: Any, installed: 3.5.0]
  - isort [required: >=4.2.5, installed: 4.3.4]
    - futures [required: Any, installed: 3.2.0]
    - futures [required: Any, installed: 3.2.0]
  - mccabe [required: Any, installed: 0.6.1]
  - singledispatch [required: Any, installed: 3.4.0.3]
    - six [required: Any, installed: 1.11.0]
  - six [required: Any, installed: 1.11.0]
python-apt==1.1.0b1+ubuntu0.16.4.1
scipy==1.1.0
  - numpy [required: >=1.8.2, installed: 1.14.3]
setuptools==20.7.0
simplegeneric==0.8.1
unity-lens-photos==1.0
virtualenv==15.2.0
websocket-client==0.47.0
  - six [required: Any, installed: 1.11.0]
wheel==0.29.0

需要注意的是,不建议在系统的Python上安装pipdeptree,因为安装后默认会装到:/usr/local/bin/pipdeptree。然后即使后面在虚拟环境中安装了pipdeptree,调用的时候还是会默认使用系统的Python对应的pipdeptree,无法查看到虚拟环境中的包依赖关系。除非指定运行虚拟环境中的venv/bin/pipdeptree

所以推荐只在各个虚拟环境中pip install pipdeptree



评论

此博客中的热门博文

Bazel WORKSPACE文件编写

Bazel的概念和技术

Bazel BUILD文件的编写