This is a bit more than what you asked for, but we have a similar situation where different directories are (possibly) using different Python/Django code. We use following to build an easy to look at list (at least for me) of Python & Django versions plus all modules and where they were loaded from. It has sometimes helped save what little there is left of my hair. Modify to taste.
import sys, re, os
import django
def ModuleList():
ret = []
# The double call to dirname() is because this file is in our utils/
# directory, which is one level down from the top of the project.
dir_project = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
project_name = os.path.basename(dir_project)
for k,v in sys.modules.items():
x = str(v)
if 'built-in' in x:
ret.append((k, 'built-in'))
continue
m = re.search(r"^.*?'(?P<module>.*?)' from '(?P<file>.*?)'.*$", x)
if m:
d = m.groupdict()
f = d['file']
# You can skip all of the re.sub()'s if you want raw paths
f = re.sub(r'/usr/.*?/lib/python[.0-9]*/site-packages/django/', 'system django >> ', f)
f = re.sub(r'/usr/.*?/lib/python[.0-9]*/site-packages/', 'site-packages >> ', f)
f = re.sub(r'/usr/.*?/lib/python[.0-9]*/', 'system python >> ', f)
f = re.sub(dir_project+'.*python/', 'local python >> ', f)
f = re.sub(dir_project+'.*django/', 'local django >> ', f)
f = re.sub(dir_project+r'(/\.\./)?', project_name + ' >> ', f)
ret.append((d['module'], f))
ret.sort( lambda a,b: cmp(a[0].lower(), b[0].lower()) )
ret.insert(0, ('Python version', sys.version) )
ret.insert(0, ('Django version', django.get_version()) )
return ret
# ModuleList