當前位置: 首頁>>代碼示例>>Python>>正文


Python sysconfig.get_path方法代碼示例

本文整理匯總了Python中sysconfig.get_path方法的典型用法代碼示例。如果您正苦於以下問題:Python sysconfig.get_path方法的具體用法?Python sysconfig.get_path怎麽用?Python sysconfig.get_path使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在sysconfig的用法示例。


在下文中一共展示了sysconfig.get_path方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: getusersitepackages

# 需要導入模塊: import sysconfig [as 別名]
# 或者: from sysconfig import get_path [as 別名]
def getusersitepackages():
    """Returns the user-specific site-packages directory path.

    If the global variable ``USER_SITE`` is not initialized yet, this
    function will also set it.
    """
    global USER_SITE
    user_base = getuserbase() # this will also set USER_BASE

    if USER_SITE is not None:
        return USER_SITE

    from sysconfig import get_path
    import os

    if sys.platform == 'darwin':
        from sysconfig import get_config_var
        if get_config_var('PYTHONFRAMEWORK'):
            USER_SITE = get_path('purelib', 'osx_framework_user')
            return USER_SITE

    USER_SITE = get_path('purelib', '%s_user' % os.name)
    return USER_SITE 
開發者ID:glmcdona,項目名稱:meddle,代碼行數:25,代碼來源:site.py

示例2: _get_library_dir

# 需要導入模塊: import sysconfig [as 別名]
# 或者: from sysconfig import get_path [as 別名]
def _get_library_dir():
    library_dir = None
    try:
        import sysconfig
        library_dir = sysconfig.get_path('purelib')
    except ImportError:
        pass  # i.e.: Only 2.7 onwards

    if library_dir is None or not os_path_exists(library_dir):
        for path in sys.path:
            if os_path_exists(path) and os.path.basename(path) == 'site-packages':
                library_dir = path
                break

    if library_dir is None or not os_path_exists(library_dir):
        library_dir = os.path.dirname(os.__file__)

    return library_dir


# Note: we can't call sysconfig.get_path from _NormPath (it deadlocks on Python 2.7) so, we
# need to get the library dir during module loading. 
開發者ID:fabioz,項目名稱:PyDev.Debugger,代碼行數:24,代碼來源:pydevd_file_utils.py

示例3: getusersitepackages

# 需要導入模塊: import sysconfig [as 別名]
# 或者: from sysconfig import get_path [as 別名]
def getusersitepackages():
    """Returns the user-specific site-packages directory path.

    If the global variable ``USER_SITE`` is not initialized yet, this
    function will also set it.
    """
    global USER_SITE
    user_base = getuserbase() # this will also set USER_BASE

    if USER_SITE is not None:
        return USER_SITE

    from sysconfig import get_path

    if sys.platform == 'darwin':
        from sysconfig import get_config_var
        if get_config_var('PYTHONFRAMEWORK'):
            USER_SITE = get_path('purelib', 'osx_framework_user')
            return USER_SITE

    USER_SITE = get_path('purelib', '%s_user' % os.name)
    return USER_SITE 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:24,代碼來源:site.py

示例4: get_stdlib

# 需要導入模塊: import sysconfig [as 別名]
# 或者: from sysconfig import get_path [as 別名]
def get_stdlib():
        paths = [
            sysconfig.get_path("stdlib"),
            sysconfig.get_path("platstdlib"),
        ]
        return set(filter(bool, paths)) 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:8,代碼來源:__init__.py

示例5: get_path

# 需要導入模塊: import sysconfig [as 別名]
# 或者: from sysconfig import get_path [as 別名]
def get_path(name):
        if name not in ('platlib', 'purelib'):
            raise ValueError("Name must be purelib or platlib")
        return get_python_lib(name=='platlib') 
開發者ID:jpush,項目名稱:jbox,代碼行數:6,代碼來源:py31compat.py

示例6: _get_purelib

# 需要導入模塊: import sysconfig [as 別名]
# 或者: from sysconfig import get_path [as 別名]
def _get_purelib():
        return get_path("purelib") 
開發者ID:jpush,項目名稱:jbox,代碼行數:4,代碼來源:bdist_egg.py

示例7: get_path

# 需要導入模塊: import sysconfig [as 別名]
# 或者: from sysconfig import get_path [as 別名]
def get_path(name):
        if name not in ('platlib', 'purelib'):
            raise ValueError("Name must be purelib or platlib")
        return get_python_lib(name == 'platlib') 
開發者ID:sofia-netsurv,項目名稱:python-netsurv,代碼行數:6,代碼來源:py31compat.py


注:本文中的sysconfig.get_path方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。