当前位置: 首页>>代码示例>>Python>>正文


Python pip._internal方法代码示例

本文整理汇总了Python中pip._internal方法的典型用法代码示例。如果您正苦于以下问题:Python pip._internal方法的具体用法?Python pip._internal怎么用?Python pip._internal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pip的用法示例。


在下文中一共展示了pip._internal方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: pip_import_string

# 需要导入模块: import pip [as 别名]
# 或者: from pip import _internal [as 别名]
def pip_import_string():
    # type: () -> str
    import pip
    pip_major_version = int(pip.__version__.split('.')[0])
    pip_minor_version = int(pip.__version__.split('.')[1])
    pip_major_minor = (pip_major_version, pip_minor_version)
    # Pip moved its internals to an _internal module in version 10.
    # In order to be compatible with version 9 which has it at at the
    # top level we need to figure out the correct import path here.
    if (9, 0) <= pip_major_minor < (10, 0):
        return 'from pip import main'
    elif (10, 0) <= pip_major_minor < (19, 3):
        # Pip changed their import structure again in 19.3
        # https://github.com/pypa/pip/commit/09fd200
        return 'from pip._internal import main'
    elif (19, 3) <= pip_major_minor < (20, 0):
        return 'from pip._internal.main import main'
    elif (20, 0) <= pip_major_minor < (21, 0):
        # More changes! https://github.com/pypa/pip/issues/7498
        return 'from pip._internal.cli.main import main'
    raise RuntimeError("Unknown import string for pip version: %s"
                       % str(pip_major_minor)) 
开发者ID:aws,项目名称:chalice,代码行数:24,代码来源:compat.py

示例2: _run_pip

# 需要导入模块: import pip [as 别名]
# 或者: from pip import _internal [as 别名]
def _run_pip(args, additional_paths=None):
    # Add our bundled software to the sys.path so we can import it
    if additional_paths is not None:
        sys.path = additional_paths + sys.path

    # Install the bundled software
    import pip._internal
    return pip._internal.main(args) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:10,代码来源:__init__.py

示例3: install_package

# 需要导入模块: import pip [as 别名]
# 或者: from pip import _internal [as 别名]
def install_package(package):
    import pip
    from pip._internal import main
    main.main(['install', package]) 
开发者ID:joelibaceta,项目名称:video-to-ascii,代码行数:6,代码来源:setup.py


注:本文中的pip._internal方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。