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


Python sysconfig.get_python_lib方法代碼示例

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


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

示例1: _compute_site_packages

# 需要導入模塊: from distutils import sysconfig [as 別名]
# 或者: from distutils.sysconfig import get_python_lib [as 別名]
def _compute_site_packages():
        def _normalized_path(path):
            return os.path.normcase(os.path.abspath(path))

        paths = set()
        real_prefix = getattr(sys, 'real_prefix', None)
        for prefix in filter(None, (real_prefix, sys.prefix)):
            path = sysconfig.get_python_lib(prefix=prefix)
            path = _normalized_path(path)
            paths.add(path)

        # Handle Debian's derivatives /usr/local.
        if os.path.isfile("/etc/debian_version"):
            for prefix in filter(None, (real_prefix, sys.prefix)):
                libpython = os.path.join(prefix, "local", "lib",
                                         "python" + sysconfig.get_python_version(),
                                         "dist-packages")
                paths.add(libpython)
        return paths 
開發者ID:AtomLinter,項目名稱:linter-pylama,代碼行數:21,代碼來源:imports.py

示例2: _compute_site_packages

# 需要導入模塊: from distutils import sysconfig [as 別名]
# 或者: from distutils.sysconfig import get_python_lib [as 別名]
def _compute_site_packages():
        def _normalized_path(path):
            return os.path.normcase(os.path.abspath(path))

        paths = set()
        real_prefix = getattr(sys, "real_prefix", None)
        for prefix in filter(None, (real_prefix, sys.prefix)):
            path = sysconfig.get_python_lib(prefix=prefix)
            path = _normalized_path(path)
            paths.add(path)

        # Handle Debian's derivatives /usr/local.
        if os.path.isfile("/etc/debian_version"):
            for prefix in filter(None, (real_prefix, sys.prefix)):
                libpython = os.path.join(
                    prefix,
                    "local",
                    "lib",
                    "python" + sysconfig.get_python_version(),
                    "dist-packages",
                )
                paths.add(libpython)
        return paths 
開發者ID:sofia-netsurv,項目名稱:python-netsurv,代碼行數:25,代碼來源:imports.py

示例3: find_package_names

# 需要導入模塊: from distutils import sysconfig [as 別名]
# 或者: from distutils.sysconfig import get_python_lib [as 別名]
def find_package_names():
    site_packages = sysconfig.get_python_lib()
    # initialize with well-known packages that don't seem to have a top_level.txt
    res = {
        'yaml': 'PyYAML',
        'Crypto': 'pycrypto',
    }
    for pth in os.listdir(site_packages):
        if not pth.endswith('.dist-info'):
            continue
        pkgname = pth.split('-', 1)[0].replace('_', '-')
        top_level_fname = os.path.join(site_packages, pth, 'top_level.txt')
        if not os.path.exists(top_level_fname):
            if pkgname not in res.values():
                print("ERR:", pth, 'has not top_level.txt')
            continue

        for modname in open(top_level_fname).read().split():
            modname = modname.replace('/', '.')
            if modname.startswith(r'win32\lib'):
                modname = modname.rsplit('\\')[1]
            res[modname] = pkgname

    return res 
開發者ID:thebjorn,項目名稱:pydeps,代碼行數:26,代碼來源:package_names.py

示例4: __init__

# 需要導入模塊: from distutils import sysconfig [as 別名]
# 或者: from distutils.sysconfig import get_python_lib [as 別名]
def __init__(self, path):
        # type: (str) -> None
        self.path = path
        self.setup = False
        self.bin_dir = get_paths(
            'nt' if os.name == 'nt' else 'posix_prefix',
            vars={'base': path, 'platbase': path}
        )['scripts']
        # Note: prefer distutils' sysconfig to get the
        # library paths so PyPy is correctly supported.
        purelib = get_python_lib(plat_specific=False, prefix=path)
        platlib = get_python_lib(plat_specific=True, prefix=path)
        if purelib == platlib:
            self.lib_dirs = [purelib]
        else:
            self.lib_dirs = [purelib, platlib] 
開發者ID:PacktPublishing,項目名稱:Mastering-Elasticsearch-7.0,代碼行數:18,代碼來源:build_env.py

示例5: _extras_paths

# 需要導入模塊: from distutils import sysconfig [as 別名]
# 或者: from distutils.sysconfig import get_python_lib [as 別名]
def _extras_paths(cls):
    standard_lib = sysconfig.get_python_lib(standard_lib=True)

    try:
      makefile = sysconfig.parse_makefile(sysconfig.get_makefile_filename())
    except (AttributeError, IOError):
      # This is not available by default in PyPy's distutils.sysconfig or it simply is
      # no longer available on the system (IOError ENOENT)
      makefile = {}

    extras_paths = filter(None, makefile.get('EXTRASPATH', '').split(':'))
    for path in extras_paths:
      yield os.path.join(standard_lib, path)

    # Handle .pth injected paths as extras.
    sitedirs = cls._get_site_packages()
    for pth_path in cls._scan_pth_files(sitedirs):
      TRACER.log('Found .pth file: %s' % pth_path, V=3)
      for extras_path in iter_pth_paths(pth_path):
        yield extras_path 
開發者ID:pantsbuild,項目名稱:pex,代碼行數:22,代碼來源:pex.py

示例6: vcsrepo

# 需要導入模塊: from distutils import sysconfig [as 別名]
# 或者: from distutils.sysconfig import get_python_lib [as 別名]
def vcsrepo(self, repo):
        # type (VCSRepository) -> None
        self._vcsrepo = repo
        ireq = self.ireq
        wheel_kwargs = self.wheel_kwargs.copy()
        wheel_kwargs["src_dir"] = repo.checkout_directory
        with pip_shims.shims.global_tempdir_manager(), temp_path():
            ireq.ensure_has_source_dir(wheel_kwargs["src_dir"])
            sys.path = [repo.checkout_directory, "", ".", get_python_lib(plat_specific=0)]
            setupinfo = SetupInfo.create(
                repo.checkout_directory,
                ireq=ireq,
                subdirectory=self.subdirectory,
                kwargs=wheel_kwargs,
            )
            self._setup_info = setupinfo
            self._setup_info.reload() 
開發者ID:pypa,項目名稱:pipenv,代碼行數:19,代碼來源:requirements.py

示例7: get_site_packages

# 需要導入模塊: from distutils import sysconfig [as 別名]
# 或者: from distutils.sysconfig import get_python_lib [as 別名]
def get_site_packages():  # pragma: no cover
    try:
        paths = site.getsitepackages()
        if site.ENABLE_USER_SITE:
            paths.append(site.getusersitepackages())
        return paths

    # virtualenv does not ship with a getsitepackages impl so we fallback
    # to using distutils if we can
    # https://github.com/pypa/virtualenv/issues/355
    except Exception:
        try:
            from distutils.sysconfig import get_python_lib

            return [get_python_lib()]

        # just incase, don't fail here, it's not worth it
        except Exception:
            return []


################################################
# cross-compatible metaclass implementation
# Copyright (c) 2010-2012 Benjamin Peterson 
開發者ID:Pylons,項目名稱:hupper,代碼行數:26,代碼來源:compat.py

示例8: __init__

# 需要導入模塊: from distutils import sysconfig [as 別名]
# 或者: from distutils.sysconfig import get_python_lib [as 別名]
def __init__(self):
        """Initialize a new DistFilesFinder."""
        try:
            self.sitedirs = set(site.getsitepackages() + [site.getusersitepackages()])
        except AttributeError:
            self.sitedirs = [get_python_lib()] 
開發者ID:src-d,項目名稱:modelforge,代碼行數:8,代碼來源:environment.py

示例9: get_stdlib

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

示例10: get_path

# 需要導入模塊: from distutils import sysconfig [as 別名]
# 或者: from distutils.sysconfig import get_python_lib [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

示例11: _get_purelib

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

示例12: collect_stdlib_distributions

# 需要導入模塊: from distutils import sysconfig [as 別名]
# 或者: from distutils.sysconfig import get_python_lib [as 別名]
def collect_stdlib_distributions():
    """Yield a conventional spec and the names of all top_level standard library modules."""
    distribution_spec = 'Python==%d.%d.%d' % sys.version_info[:3]
    stdlib_path = sysconfig.get_python_lib(standard_lib=True)
    distribution_top_level = [name for _, name, _ in pkgutil.iter_modules(path=[stdlib_path])]
    distribution_top_level += list(sys.builtin_module_names)
    yield distribution_spec, distribution_top_level 
開發者ID:nodev-io,項目名稱:pytest-nodev,代碼行數:9,代碼來源:collect.py

示例13: _determine_location_for

# 需要導入模塊: from distutils import sysconfig [as 別名]
# 或者: from distutils.sysconfig import get_python_lib [as 別名]
def _determine_location_for(self, path):
        parts = path.split(os.path.sep)
        # Heuristic classifier
        if 'site-packages' in parts:
            return '3'
        elif _PYTHON_VERSION in parts:
            return 'S'
        # Use table from sysconfig.get_python_lib()
        for dir, location in self.lib_locations:
            if path.startswith(dir):
                return location
        return 'L' 
開發者ID:alecthomas,項目名稱:importmagic,代碼行數:14,代碼來源:index.py

示例14: get_path

# 需要導入模塊: from distutils import sysconfig [as 別名]
# 或者: from distutils.sysconfig import get_python_lib [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


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