用于列出 Jupyter 笔记本中使用的软件包版本的软件包 [英] Package for listing version of packages used in a Jupyter notebook

查看:58
本文介绍了用于列出 Jupyter 笔记本中使用的软件包版本的软件包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我似乎记得有一个包打印了 Jupyter notebook 中使用的 Python 包的版本和相关信息,因此其中的结果是可重现的.但我不记得包裹的名字.你们中有人能指出我正确的方向吗?

I seem to remember there is a package that printed the versions and relevant information about Python packages used in a Jupyter notebook so the results in it were reproducible. But I cannot remember the name of the package. Can any of you point me in the right direction?

提前致谢!

推荐答案

这会获取所有已安装的包

This gets all the installed packages

import pip #needed to use the pip functions
for i in pip.get_installed_distributions(local_only=True):
    print(i)

从当前笔记本中获取软件包列表

To get the list of packages from current notebook

import types
def imports():
    for name, val in globals().items():
        if isinstance(val, types.ModuleType):
            yield val.__name__
list(imports())

这篇关于用于列出 Jupyter 笔记本中使用的软件包版本的软件包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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