if 'LD_LIBRARY_PATH' not in os.environ:
    os.environ['LD_LIBRARY_PATH'] = '/usr/lib/oracle/XX.Y/client64/lib'
os.environ['ORACLE_HOME'] = '/usr/lib/oracle/XX.Y/client64'
Setting LD_LIBRARY_PATH from inside Python