()
return sitedirs
Return a list of 'site' dirs
Return a list of 'site' dirs
Return a list of site dirs
def get_site_dirs():
    """
    Return a list of 'site' dirs
    """

    sitedirs = []

    # start with PYTHONPATH
    sitedirs.extend(_pythonpath())

    prefixes = [sys.prefix]
    if sys.exec_prefix != sys.prefix:
        prefixes.append(sys.exec_prefix)
    for prefix in prefixes:
        if prefix:
            if sys.platform in ('os2emx', 'riscos'):
                sitedirs.append(os.path.join(prefix, "Lib", "site-packages"))
            elif os.sep == '/':
                sitedirs.extend([
                    os.path.join(
                        prefix,
                        "lib",
                        "python" + sys.version[:3],
                        "site-packages",
                    ),
                    os.path.join(prefix, "lib", "site-python"),
                ])
            else:
                sitedirs.extend([
                    prefix,
                    os.path.join(prefix, "lib", "site-packages"),
                ])
            if sys.platform == 'darwin':
                # for framework builds *only* we add the standard Apple
                # locations. Currently only per-user, but /Library and
                # /Network/Library could be added too
                if 'Python.framework' in prefix:
                    home = os.environ.get('HOME')
                    if home:
                        home_sp = os.path.join(
                            home,
                            'Library',
                            'Python',
                            sys.version[:3],
                            'site-packages',
                        )
                        sitedirs.append(home_sp)
    lib_paths = get_path('purelib'), get_path('platlib')
    for site_lib in lib_paths:
        if site_lib not in sitedirs:
            sitedirs.append(site_lib)

    if site.ENABLE_USER_SITE:
        sitedirs.append(site.USER_SITE)

    try:
        sitedirs.extend(site.getsitepackages())
    except AttributeError:
        pass

    sitedirs = list(map(normalize_path, sitedirs))

    return sitedirs
def get_site_dirs ( ) : sitedirs = [ ] # start with PYTHONPATH sitedirs . extend ( _pythonpath ( ) ) prefixes = [ sys . prefix ] if sys . exec_prefix != sys . prefix : prefixes . append ( sys . exec_prefix ) for prefix in prefixes : if prefix : if sys . platform in ( 'os2emx' , 'riscos' ) : sitedirs . append ( os . path . join ( prefix , "Lib" , "site-packages" ) ) elif os . sep == '/' : sitedirs . extend ( [ os . path . join ( prefix , "lib" , "python" + sys . version [ : 3 ] , "site-packages" , ) , os . path . join ( prefix , "lib" , "site-python" ) , ] ) else : sitedirs . extend ( [ prefix , os . path . join ( prefix , "lib" , "site-packages" ) , ] ) if sys . platform == 'darwin' : # for framework builds *only* we add the standard Apple # locations. Currently only per-user, but /Library and # /Network/Library could be added too if 'Python.framework' in prefix : home = os . environ . get ( 'HOME' ) if home : home_sp = os . path . join ( home , 'Library' , 'Python' , sys . version [ : 3 ] , 'site-packages' , ) sitedirs . append ( home_sp ) lib_paths = get_path ( 'purelib' ) , get_path ( 'platlib' ) for site_lib in lib_paths : if site_lib not in sitedirs : sitedirs . append ( site_lib ) if site . ENABLE_USER_SITE : sitedirs . append ( site . USER_SITE ) try : sitedirs . extend ( site . getsitepackages ( ) ) except AttributeError : pass sitedirs = list ( map ( normalize_path , sitedirs ) ) return sitedirs