本文整理汇总了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
示例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
示例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
示例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
示例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