有没有办法列出 pip 依赖项/要求? [英] Is there a way to list pip dependencies/requirements?

查看:36
本文介绍了有没有办法列出 pip 依赖项/要求?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不进行安装,我想快速查看 pip install 将安装的所有包.

Without going through with the installation, I want to quickly see all the packages that pip install would install.

推荐答案

接受的答案不再与当前 pip 的更多版本相关,并且不会在不仔细阅读多个评论的情况下立即给出答案,因此我提供了更新的答案.

The accepted answer is no longer relevant for more current versions of pip and does not give an immediate answer without perusing multiple comments so I am providing an updated answer.

这是使用 pip 版本 8.1.29.0.110.0.118.1 测试的>.

This was tested with pip versions 8.1.2, 9.0.1, 10.0.1, and 18.1.

要在不弄乱 Linux 上当前目录的情况下获得输出

To get the output without cluttering your current directory on Linux use

pip download [package] -d /tmp --no-binary :all: -v

-d 告诉 pip 下载文件的目录.

-d tells pip the directory that download should put files in.

更好,只需使用此脚本,参数为包名即可仅获取依赖项作为输出:

Better, just use this script with the argument being the package name to get only the dependencies as output:

#!/bin/sh

PACKAGE=$1
pip download $PACKAGE -d /tmp --no-binary :all:-v 2>&1 
| grep Collecting 
| cut -d' ' -f2 
| grep -Ev "$PACKAGE(~|=|!|>|<|$)"

也可以在此处使用.

这篇关于有没有办法列出 pip 依赖项/要求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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