Identifying the dependency relationship for python packages installed with pip

前端 未结 8 637
隐瞒了意图╮
隐瞒了意图╮ 2020-11-29 16:20

When I do a pip freeze I see large number of Python packages that I didn\'t explicitly install, e.g.

$ pip freeze
Cheetah==2.4.3
GnuPGInterface==0.3.2
Landsc         


        
相关标签:
8条回答
  • 2020-11-29 16:58

    (workaround, not true answer)

    Had the same problem, with lxml not installing and me wanting to know who needed lxml. Not who lxml needed. Ended up bypassing the issue by.

    1. noting where my site packages were being put.

    2. go there and recursive grep for the import (the last grep's --invert-match serves to remove lxml's own files from consideration).

    Yes, not an answer as to how to use pip to do it, but I didn't get any success out of the suggestions here, for whatever reason.

     site-packages me$ egrep -i --include=*.py  -r -n lxml . | grep import | grep --invert-match /lxml/
    
    0 讨论(0)
  • 2020-11-29 16:59

    First of all pip freeze displays all currently installed packages Python, not necessarily using PIP.

    Secondly Python packages do contain the information about dependent packages as well as required versions. You can see the dependencies of particular pkg using the methods described here. When you're upgrading a package the installer script like PIP will handle the upgrade of dependencies for you.

    To solve updating of packages i recommend using PIP requirements files. You can define what packages and versions you need, and install them at once using pip install.

    0 讨论(0)
提交回复
热议问题