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


Python PythonInterpreter.from_env方法代码示例

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


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

示例1: to_python_interpreter

# 需要导入模块: from pex.interpreter import PythonInterpreter [as 别名]
# 或者: from pex.interpreter.PythonInterpreter import from_env [as 别名]
 def to_python_interpreter(full_path_or_basename):
   if os.path.exists(full_path_or_basename):
     return PythonInterpreter.from_binary(full_path_or_basename)
   else:
     interpreter = PythonInterpreter.from_env(full_path_or_basename)
     if interpreter is None:
       die('Failed to find interpreter: %s' % full_path_or_basename)
     return interpreter
开发者ID:jsirois,项目名称:pex,代码行数:10,代码来源:pex.py

示例2: interpreter_from_options

# 需要导入模块: from pex.interpreter import PythonInterpreter [as 别名]
# 或者: from pex.interpreter.PythonInterpreter import from_env [as 别名]
def interpreter_from_options(options):
  interpreter = None
  if options.python:
    if os.path.exists(options.python):
      interpreter = PythonInterpreter.from_binary(options.python)
    else:
      interpreter = PythonInterpreter.from_env(options.python)
    if interpreter is None:
      die('Failed to find interpreter: %s' % options.python)
  else:
    interpreter = PythonInterpreter.get()
  return interpreter
开发者ID:Yasumoto,项目名称:pex,代码行数:14,代码来源:pex.py

示例3: _establish_interpreter

# 需要导入模块: from pex.interpreter import PythonInterpreter [as 别名]
# 或者: from pex.interpreter.PythonInterpreter import from_env [as 别名]
def _establish_interpreter(args):
    if args.python:
        if os.path.exists(args.python):
            interpreter = PythonInterpreter.from_binary(args.python)
        else:
            interpreter = PythonInterpreter.from_env(args.python)
        if interpreter is None:
            die('Failed to find interpreter: %s' % args.python)
    else:
        interpreter = PythonInterpreter.get()

    with TRACER.timed('Setting up interpreter %s' % interpreter.binary, V=2):
        resolve = functools.partial(resolve_interpreter, args.interpreter_cache_dir, args.repos)

        # resolve setuptools
        interpreter = resolve(interpreter, SETUPTOOLS_REQUIREMENT)

        # possibly resolve wheel
        if interpreter and args.use_wheel:
            interpreter = resolve(interpreter, WHEEL_REQUIREMENT)

        return interpreter
开发者ID:GregBowyer,项目名称:spex,代码行数:24,代码来源:spex.py

示例4: get_interpreter

# 需要导入模块: from pex.interpreter import PythonInterpreter [as 别名]
# 或者: from pex.interpreter.PythonInterpreter import from_env [as 别名]
def get_interpreter(python_interpreter, interpreter_cache_dir, repos, use_wheel):
  interpreter = None

  if python_interpreter:
    if os.path.exists(python_interpreter):
      interpreter = PythonInterpreter.from_binary(python_interpreter)
    else:
      interpreter = PythonInterpreter.from_env(python_interpreter)
    if interpreter is None:
      die('Failed to find interpreter: %s' % python_interpreter)
  else:
    interpreter = PythonInterpreter.get()

  with TRACER.timed('Setting up interpreter %s' % interpreter.binary, V=2):
    resolve = functools.partial(resolve_interpreter, interpreter_cache_dir, repos)

    # resolve setuptools
    interpreter = resolve(interpreter, SETUPTOOLS_REQUIREMENT)

    # possibly resolve wheel
    if interpreter and use_wheel:
      interpreter = resolve(interpreter, WHEEL_REQUIREMENT)

    return interpreter
开发者ID:sixninetynine,项目名称:pex,代码行数:26,代码来源:pex.py

示例5: interpreter_from_options

# 需要导入模块: from pex.interpreter import PythonInterpreter [as 别名]
# 或者: from pex.interpreter.PythonInterpreter import from_env [as 别名]
def interpreter_from_options(options):
    interpreter = None

    if options.python:
        if os.path.exists(options.python):
            interpreter = PythonInterpreter.from_binary(options.python)
        else:
            interpreter = PythonInterpreter.from_env(options.python)
        if interpreter is None:
            die("Failed to find interpreter: %s" % options.python)
    else:
        interpreter = PythonInterpreter.get()

    with TRACER.timed("Setting up interpreter %s" % interpreter.binary, V=2):
        resolve = functools.partial(resolve_interpreter, options.interpreter_cache_dir, options.repos)

        # resolve setuptools
        interpreter = resolve(interpreter, SETUPTOOLS_REQUIREMENT)

        # possibly resolve wheel
        if interpreter and options.use_wheel:
            interpreter = resolve(interpreter, WHEEL_REQUIREMENT)

        return interpreter
开发者ID:twitter,项目名称:heron,代码行数:26,代码来源:pex.py


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