We’ve gone through how to get session information in R previously, so how do we do the same for Python? It seems that there is no single convenient function available so here’s one approach.
To get the system information, you can utilize the commonly used IPython package:
import IPython
IPython.sys_info()
To find out packages that have been loaded at the time (includes modules loaded by Python itself and by any Python IDE), you can utilize the sys.modules.keys()
method. The code below gets the package name rather than the sub-components.
import sys
packages = set()
for name in sys.modules.keys():
packages.add(name.split('.')[0])
print sorted(packages)