简体   繁体   中英

Is it possible to construct a program to determine what libraries another python program is using?

Say for instance I have a python web app in flask/django that makes use of tensorflow and nltk libraries.

Is it possible for another program running on the same computer to somehow inspect the python program and determine what libraries it is using? Eg somehow inspect the memory space and determine it has been using nltk and tensorflow libraries?

From the Python docs:

modulefinder — Find modules used by a script

This module provides a ModuleFinder class that can be used to determine the set of modules imported by a script. modulefinder.py can also be run as a script, giving the filename of a Python script as its argument, after which a report of the imported modules will be printed.

You will need to know the name of the script, however, for the modulefinder to work.

More info on the library is here: modulefinder docs

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM