-u、-m参数有什么作用?
What do -u, -m parameters do?
参数 -u
、-m
是什么意思,它们有什么作用?
例如:
python -u my_script.py
或
python -m my_script.py
我在哪里可以读到它们?
-u
用于强制 stdin
、stdout
和 stderr
完全无缓冲,否则在终端
上行缓冲
-m
搜索 sys.path
命名模块并运行相应的 .py 文件作为脚本。一个例子是 timeit
模块。命令 python -m timeit "python script"
将 return 脚本执行所花费的时间。
引用文档
Force stdin
, stdout
and stderr
to be totally unbuffered. On systems where it matters, also put stdin
, stdout
and stderr
in binary
mode.
Search sys.path
for the named module and execute its contents as the __main__
module.
您可以阅读有关它们和其他选项的更多信息here
参数 -u
、-m
是什么意思,它们有什么作用?
例如:
python -u my_script.py
或
python -m my_script.py
我在哪里可以读到它们?
-u
用于强制 stdin
、stdout
和 stderr
完全无缓冲,否则在终端
-m
搜索 sys.path
命名模块并运行相应的 .py 文件作为脚本。一个例子是 timeit
模块。命令 python -m timeit "python script"
将 return 脚本执行所花费的时间。
引用文档
Force
stdin
,stdout
andstderr
to be totally unbuffered. On systems where it matters, also putstdin
,stdout
andstderr
in binary mode.Search
sys.path
for the named module and execute its contents as the__main__
module.
您可以阅读有关它们和其他选项的更多信息here