如何使用PIP看到依赖于某个程序包的所有程序包? [英] How can I see all packages that depend on a certain package with PIP?

查看:823
本文介绍了如何使用PIP看到依赖于某个程序包的所有程序包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想查看依赖于带有PIP的某些软件包的软件包列表.也就是说,给定django,我希望看到django-cmsdjango-filer,因为我已经安装了这些软件包,并且它们都具有django作为依赖项.

I would like to see a list of packages that depend on a certain package with PIP. That is, given django, I would like to see django-cms, django-filer, because I have these packages installed and they all have django as dependency.

推荐答案

非常简单:

pip show <insert_package_name_here>| grep ^Requires

反之亦然:(对不起,我看错了!)

Or the other way around: (sorry i got it wrong!)

for NAME in $(pip freeze | cut -d= -f1); do REQ=$(pip show $NAME| grep Requires); if [[ "$REQ" =~ "$REQUIRES" ]]; then echo $REQ;echo "Package: $NAME"; echo "---" ; fi;  done

在此之前,将您的搜索字符串设置为:

before that set your search-string with:

REQUIRES=django

基本上,您必须遍历整个列表并查询每个列表.这可能需要一些时间.

essentially you have to go through the whole list and query for every single one. That may take some time.

同样,它仅适用于已安装的程序包,我看不到pip可以提供未安装程序包的依赖项.

Also it does only work on installed packages, I don't see pip providing dependencies on not installed packages.

这篇关于如何使用PIP看到依赖于某个程序包的所有程序包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆