当前位置: 首页>>代码示例>>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;未经允许,请勿转载。