本文整理匯總了Python中multiprocessing.util._args_from_interpreter_flags方法的典型用法代碼示例。如果您正苦於以下問題:Python util._args_from_interpreter_flags方法的具體用法?Python util._args_from_interpreter_flags怎麽用?Python util._args_from_interpreter_flags使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類multiprocessing.util
的用法示例。
在下文中一共展示了util._args_from_interpreter_flags方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get_command_line
# 需要導入模塊: from multiprocessing import util [as 別名]
# 或者: from multiprocessing.util import _args_from_interpreter_flags [as 別名]
def get_command_line():
'''
Returns prefix of command line used for spawning a child process
'''
if getattr(process.current_process(), '_inheriting', False):
raise RuntimeError('''
Attempt to start a new process before the current process
has finished its bootstrapping phase.
This probably means that you are on Windows and you have
forgotten to use the proper idiom in the main module:
if __name__ == '__main__':
freeze_support()
...
The "freeze_support()" line can be omitted if the program
is not going to be frozen to produce a Windows executable.''')
if getattr(sys, 'frozen', False):
return [sys.executable, '--multiprocessing-fork']
else:
prog = 'from multiprocessing.forking import main; main()'
opts = util._args_from_interpreter_flags()
return [_python_exe] + opts + ['-c', prog, '--multiprocessing-fork']
示例2: get_command_line
# 需要導入模塊: from multiprocessing import util [as 別名]
# 或者: from multiprocessing.util import _args_from_interpreter_flags [as 別名]
def get_command_line(pipe_handle, **kwds):
'''
Returns prefix of command line used for spawning a child process
'''
if getattr(sys, 'frozen', False):
return ([sys.executable, '--multiprocessing-fork', pipe_handle])
else:
prog = 'from loky.backend.popen_loky_win32 import main; main()'
opts = util._args_from_interpreter_flags()
return [spawn.get_executable()] + opts + [
'-c', prog, '--multiprocessing-fork', pipe_handle]