def which_prefix(path):
 prefix = abspath(path)
 while True:
  if isdir(join(prefix, u'conda-meta')):
   return prefix
  if (prefix == dirname(prefix)):
   return None
  prefix = dirname(prefix)

def which_prefix ( path ) : prefix = abspath ( path ) while True : if isdir ( join ( prefix , u'conda-meta' ) ) : return prefix if ( prefix == dirname ( prefix ) ) : return None prefix = dirname ( prefix )
given the path (to a conda installed file) return the environment prefix in which the file in located .