[英]What do -u, -m parameters do?
What do parameters -u
, -m
mean and what do they do? 参数
-u
, -m
是什么意思,它们的作用是什么?
for example: 例如:
python -u my_script.py
or 要么
python -m my_script.py
Where can I read about them? 我在哪里可以读到它们?
-u
is used to force stdin
, stdout
and stderr
to be totally unbuffered, which otherwise is line buffered on the terminal -u
用于强制将stdin
, stdout
和stderr
完全取消缓冲,否则将在终端上对其进行行缓冲
-m
searches sys.path
for the named module and runs the corresponding .py file as a script. -m
sys.path
中搜索指定的模块,然后将相应的.py文件作为脚本运行。 An example would be timeit
module. 一个例子是
timeit
模块。 The command python -m timeit "python script"
would return the time taken for the script to execute. 命令
python -m timeit "python script"
将返回脚本执行所花费的时间。
Quoting from the docs 引用文档
Force
stdin
,stdout
andstderr
to be totally unbuffered.强制
stdin
,stdout
和stderr
完全没有缓冲。 On systems where it matters, also putstdin
,stdout
andstderr
in binary mode.在重要的系统上,还将
stdin
,stdout
和stderr
置于二进制模式。Search
sys.path
for the named module and execute its contents as the__main__
module.在
sys.path
中搜索命名模块,并将其内容作为__main__
模块执行。
You can read more about them and other options here 您可以在此处阅读有关它们和其他选项的更多信息
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.