在Python中查找依赖项的来源?

时间:2011-09-14 18:46:46

标签: python dependencies setuptools pip

当我运行pip install .时,我安装了所有依赖项,包括传递依赖项,但问题是有两个模块依赖于两个不同版本的lxml。如何通过pip或任何其他工具找出谁需要什么?

1 个答案:

答案 0 :(得分:1)

您是否了解哪些模块依赖于lxml?如果是这样,您只需检查那些模块setup.py文件并检查install_requires,大多数包创建者也将包含版本号。 e.g。

  install_requires=[
    'django-modeldict>=1.1.6',
    'nexus>=0.1.7',
    'django-jsonfield',
  ],

来自:https://github.com/disqus/gargoyle/blob/master/setup.py

您可能还想查看modulefinder之类的内容,但我认为在这种情况下只需检查setup.py就容易多了。