首页 > 解决方案 > 如何让 pip 列出它正在使用的存储库?

问题描述

我试图在我的机器上运行一个代码库,而 pip 没有找到一些依赖项。似乎在另一台机器上找到了它们,所以我想看看这两台机器上使用的是哪个 repos pip,以便进行比较。

我怎样才能做到这一点?

标签: pythonpip

解决方案


更新为pip>=20

现在默认列出存储库,无需传递--verbose参数:

$ pip download --no-cache-dir "foo<0" 2>&1 | grep Looking
Looking in indexes: https://pypi.org/simple, https://my-index.local, http://127.0.0.1:9000

原始答案

使用flag:或pip时显示搜索包的存储库。指定一些不存在的要求,因此实际上不会下载/安装任何东西。例子:--verbosepip install --verbose ...pip download --verbose ...pip

$ pip download --no-cache-dir --verbose "foo<0" 2>&1 | grep Looking
Looking in indexes: https://pypi.org/simple, https://my-index.local, http://127.0.0.1:9000

推荐阅读