获取当前会话中所有导入模块的版本
pyversions的Python项目详细描述
pyversions
获取当前会话中导入模块的版本:pyversions.versions版本()
专为使用Jupyter笔记本而设计。
在导入所有模块/函数后立即在单元格中调用此函数。
此函数使用Python inspect模块获取调用方的全局名称空间;如果不能,则应将globals()作为参数传递。在
安装
pip install pyversions
或者
^{pr2}$示例
>>>importpyversions>>>vs=pyversions.versions()>>>frompyversionsimportversions>>>versions();# semicolon to avoid printing information twice
帮助
"""Get versions of imported modules in current session: pyversions.versions()Parameters----------glbs : globals(), optional (default=None) Get all the imported modules from the passed globals() namespace.show : bool, optional (default=True) Whether to print information about environment and imported modules.Returns-------info : list of strings list of strings with information about the current environment and imported modules.Notes-----Designed particularly to work within a Jupyter notebook.Call this function in a cell just after all modules/functions are imported.This function uses Python inspect module to get the caller's globalnamespace; it should work, if not, pass globals() as a parameter.Based on https://stackoverflow.com/questions/40428931Examples-------->>> import pyversions>>> vs = pyversions.versions()>>> from pyversions import versions>>> versions(); # semicolon to avoid printing information twice[In a Jupyter notebook](https://github.com/demotu/pyversions/blob/master/docs/pyversions.ipynb) Version history---------------'0.0.1' : The first version"""
如何引用这部作品
以下是引用GitHub存储库的建议:
Duarte, M. (2020) pyversions: A Python module to get versions of imported modules in current session. GitHub repository, https://github.com/demotu/pyversions.
以及可能的BibTeX入口:
@misc{Duarte2020, author = {Duarte, M.}, title = {pyversions: A Python module to get versions of imported modules in current session}, year = {2020}, publisher = {GitHub}, journal = {GitHub repository}, howpublished = {\url{https://github.com/demotu/pyversions}}}
许可证
此项目的非软件内容在Creative Commons Attribution 4.0 International License下授权,软件代码在MIT license下授权。在
- 项目
标签: