my_site = os.path.join(os.environ['HOME'], 
    '.local/lib/python%d.%d/site-packages' % (sys.version_info[0], sys.
    version_info[1]))
for idx, pth in enumerate(sys.path):
    pass
How to tell Python to prefer module from $HOME/lib/python over /usr/lib/python?