def GetCleanEnvironment():
 env = os.environ.copy()
 old_virtual_prompt = env.pop('_OLD_VIRTUAL_PROMPT', None)
 if old_virtual_prompt:
  env['PROMPT'] = old_virtual_prompt
 old_virtual_path = env.pop('_OLD_VIRTUAL_PATH', None)
 if old_virtual_path:
  env['PATH'] = old_virtual_path
 return env

def GetCleanEnvironment ( ) : env = os . environ . copy ( ) old_virtual_prompt = env . pop ( '_OLD_VIRTUAL_PROMPT' , None ) if old_virtual_prompt : env [ 'PROMPT' ] = old_virtual_prompt old_virtual_path = env . pop ( '_OLD_VIRTUAL_PATH' , None ) if old_virtual_path : env [ 'PATH' ] = old_virtual_path return env
restore environment to pre-virtualenv activate .