def addusersitepackages(known_paths):
 global USER_BASE, USER_SITE, ENABLE_USER_SITE
 env_base = os.environ.get('PYTHONUSERBASE', None)
 def joinuser(*args):
  return os.path.expanduser(os.path.join(*args))
 if (os.name == 'nt'):
  base = (os.environ.get('APPDATA') or '~')
  USER_BASE = (env_base if env_base else joinuser(base, 'Python'))
  USER_SITE = os.path.join(USER_BASE, (('Python' + sys.version[0]) + sys.version[2]), 'site-packages')
 else:
  USER_BASE = (env_base if env_base else joinuser('~', '.local'))
  USER_SITE = os.path.join(USER_BASE, 'lib', ('python' + sys.version[:3]), 'site-packages')
 if (ENABLE_USER_SITE and os.path.isdir(USER_SITE)):
  addsitedir(USER_SITE, known_paths)
 return known_paths

def addusersitepackages ( known_paths ) : global USER_BASE , USER_SITE , ENABLE_USER_SITE env_base = os . environ . get ( 'PYTHONUSERBASE' , None ) def joinuser ( * args ) : return os . path . expanduser ( os . path . join ( * args ) ) if ( os . name == 'nt' ) : base = ( os . environ . get ( 'APPDATA' ) or '~' ) USER_BASE = ( env_base if env_base else joinuser ( base , 'Python' ) ) USER_SITE = os . path . join ( USER_BASE , ( ( 'Python' + sys . version [ 0 ] ) + sys . version [ 2 ] ) , 'site-packages' ) else : USER_BASE = ( env_base if env_base else joinuser ( '~' , '.local' ) ) USER_SITE = os . path . join ( USER_BASE , 'lib' , ( 'python' + sys . version [ : 3 ] ) , 'site-packages' ) if ( ENABLE_USER_SITE and os . path . isdir ( USER_SITE ) ) : addsitedir ( USER_SITE , known_paths ) return known_paths
add a per user site-package to sys .