I posted this question on the git issue tracker: https://github.com/pypa/pip/issues/2969
Can we have some manner of calling pip freeze/list within python, i.e. not a
It's not recommended to rely on a "private" function such as pip._internal.operatons. You can do the following instead:
pip._internal.operatons
import pkg_resources env = dict(tuple(str(ws).split()) for ws in pkg_resources.working_set)