pip - List required packages by introspection in Python -
how can list requires packages introspection running python or ipython instance?
i start development loaded conda environment has full anaconda distribution , whole lo more installed. when wish share code able spit out requirements.txt
pip or environment.yml
conda consisting of packages currrently loaded in interpreter.
how can this?
you use python builtin package modulefinder test script modules. like:
from modulefinder import modulefinder finder = modulefinder() finder.run_script('bacon.py') print('loaded modules:') name, mod in finder.modules.items(): print('%s: ' % name, end='') print(','.join(list(mod.globalnames.keys())[:3])) print('-'*50) print('modules not imported:') print('\n'.join(finder.badmodules.keys()))
Comments
Post a Comment