py -h的输出翻译
仅供参考,能力有限,大部分都是机翻,只有少部分是我自己的理解.
译文:
C:\Users\rkey>py -h Python Launcher for Windows Version 3.12.4 Windows版Python启动器3.12.4 usage: 用法: py [launcher-args] [python-args] [script [script-args]] py [启动器参数] [python参数] [脚本 [脚本参数]] Launcher arguments: 启动器参数: -2 : Launch the latest Python 2.x version -2:启动最新的Python 2.x版本 -3 : Launch the latest Python 3.x version -3:启动最新的Python 3.x版本 -X.Y : Launch the specified Python version -X.Y:启动指定的Python版本 The above default to an architecture native runtime, but will select any available. Add a "-32" to the argument to only launch 32-bit runtimes, or add "-64" to omit 32-bit runtimes (this latter option is deprecated). 上述默认为架构本机运行时,将选择任意一个可用的。 在参数中添加“-32”以仅启动32位运行时, 或者添加“-64”以省略32位运行时(后一种选项已弃用)。 To select a specific runtime, use the -V: options. 要选择特定的运行时,请使用-V:选项。 -V:TAG : Launch a Python runtime with the specified tag -V:TAG :使用指定的标记启动Python运行时 -V:COMPANY/TAG : Launch a Python runtime from the specified company and with the specified tag -V:COMPANY/TAG :用指定的发行版本号和指定的标记启动Python运行时(补充说明,有些python版本后面会有alpha beta rc等等标签,这个COMPANY/TAG有可能指的是这些.) -0 --list : List the available pythons -0 --list :列出可用的python -0p --list-paths : List with paths -0p --list-paths :列出加入环境变量的python的绝对路径 If no options are given but a script is specified, the script is checked for a shebang line. Otherwise, an active virtual environment or global default will be selected. 如果没有给出选项但指定了脚本,则检查脚本中是否有shebang行。否则,将选择激活虚拟环境或全局默认的python解释器。 (shebang,专门查了一下这是个什么东西, 有人叫做释伴,解释并随随行的意思,就是一般脚本文件中第一行开头的那一行文字,用来给脚本解释器指定用啥来执行这个脚本的. 例如python脚本开头第一行可能会有 #! /usr/bin/python或者#! /usr/bin/env
或者
#! python3 例如linux脚本,第一行可能会有 #!/bin/bash 有关shebang翻译的资料:https://zhuanlan.zhihu.com/p/685387486 ) See https://docs.python.org/using/windows.html#python-launcher-for-windows for additional configuration. 请参阅下面链接中对于[附加配置]的相关描述. https://docs.python.org/using/windows.html#python-launcher-for-windows The following help text is from Python: 以下帮助文本来自Python: usage: C:\Python312\python.exe [option] ... [-c cmd | -m mod | file | -] [arg] ... 用法:C:\Python312\python.exe [选项] ... [-c cmd | -m mod | file | - ] [ arg ] ... Options (and corresponding environment variables): 选项(和相应的环境变量): -b : issue warnings about converting bytes/bytearray to str and comparing bytes/bytearray with str or bytes with int. (-bb: issue errors) -b : 发出有关将bytes/bytearray转换为str以及将bytes/bytearray与str或bytes与int进行比较的警告。(-bb:问题错误) -B : don't write .pyc files on import; also PYTHONDONTWRITEBYTECODE=x -B : 导入时不要写入.pyc文件;还有环境变量PYTHONDONTWITEBYTECODE=x -c cmd : program passed in as string (terminates option list) -c cmd : 以字符串形式传入的程序(终止选项列表) -d : turn on parser debugging output (for experts only, only works on debug builds); also PYTHONDEBUG=x -d : 打开解析器调试输出(仅供专家使用,仅适用于调试构建;还有环境变量PYTHONDEBUG=x -E : ignore PYTHON* environment variables (such as PYTHONPATH) -E : 忽略第一个单词为PYTHON的环境变量(例如 PYTHONPATH) -h : print this help message and exit (also -? or --help) -h : 打印此帮助消息并退出(也可以是-?或--help) -i : inspect interactively after running script; forces a prompt even if stdin does not appear to be a terminal; also PYTHONINSPECT=x -i : 运行脚本后进行交互式检查;即使stdin(标准输入;标准输出;标准输入设备;标准输入流)看起来不是终端,也会强制提示;还有环境变量PYTHONINSPECT=x -I : isolate Python from the user's environment (implies -E and -s) -I : 将Python与用户环境隔离开来(包含-E和-s) -m mod : run library module as a script (terminates option list) -m mod : 将库模块作为脚本运行(终止选项列表) -O : remove assert and __debug__-dependent statements; add .opt-1 before .pyc extension; also PYTHONOPTIMIZE=x -O : 删除assert和__debug__依赖语句;在.pyc扩展名之前添加.opt-1;还有环境变量PYTHONOPTIMIZE=x -OO : do -O changes and also discard docstrings; add .opt-2 before .pyc extension -OO : do -O 更改并丢弃文档字符串;在.pyc扩展名前面添加.opt-2 -P : don't prepend a potentially unsafe path to sys.path; also PYTHONSAFEPATH -P : 不要在sys.path前添加可能不安全的路径;还有环境变量PYTHONAFEPATH -q : don't print version and copyright messages on interactive startup -q : 不要在交互式启动时打印版本和版权信息 -s : don't add user site directory to sys.path; also PYTHONNOUSERSITE=x -s : 不要将用户站点目录添加到sys.path;还有环境变量PYTHONNOSERSITE=x -S : don't imply 'import site' on initialization -S : 初始化时不要暗示“导入站点” -u : force the stdout and stderr streams to be unbuffered; this option has no effect on stdin; also PYTHONUNBUFFERED=x -u : 强制取消stdout和stderr流的缓冲;此选项对stdin没有影响;还有环境变量PYTHONBUFFERED=x -v : verbose (trace import statements); also PYTHONVERBOSE=x can be supplied multiple times to increase verbosity -v : verbose(跟踪导入语句);此外,环境变量PYTHONVERBOSE=x可以多次提供以增加详细程度 -V : print the Python version number and exit (also --version) when given twice, print more information about the build -V : 打印Python版本号,并在给出两次时退出(也可以是--version),打印有关构建的更多信息 -W arg : warning control; arg is action:message:category:module:lineno also PYTHONWARNINGS=arg -W arg : 警告控制;arg是操作:消息:类别:模块:行号, 还有环境变量PYTHONWARNINGS=arg -x : skip first line of source, allowing use of non-Unix forms of #!cmd -x : 跳过源代码的第一行,允许使用非Unix形式的#!cmd -X opt : set implementation-specific option -X opt : 设置特定于实现的选项 --check-hash-based-pycs always|default|never: control how Python invalidates hash-based .pyc files --check-hash-based-pycs always|default|never: 控制Python如何使基于哈希的.pyc文件无效 --help-env: print help about Python environment variables and exit --help-env: 打印关于Python环境变量的帮助并退出 --help-xoptions: print help about implementation-specific -X options and exit --help-xoptions: 打印有关特定于实现的-X选项和退出的帮助 --help-all: print complete help information and exit --help-all: 打印完整的帮助信息并退出 Arguments: 参数: file : program read from script file file : 从脚本文件读取程序 - : program read from stdin (default; interactive mode if a tty) - : 从stdin读取程序(默认;如果是tty,则为交互模式) arg ...: arguments passed to program in sys.argv[1:] arg ...: 在sys.argv[1:]中传递给程序的参数
原文:
C:\Users\rkey>py -h Python Launcher for Windows Version 3.12.4 usage: py [launcher-args] [python-args] [script [script-args]] Launcher arguments: -2 : Launch the latest Python 2.x version -3 : Launch the latest Python 3.x version -X.Y : Launch the specified Python version The above default to an architecture native runtime, but will select any available. Add a "-32" to the argument to only launch 32-bit runtimes, or add "-64" to omit 32-bit runtimes (this latter option is deprecated). To select a specific runtime, use the -V: options. -V:TAG : Launch a Python runtime with the specified tag -V:COMPANY/TAG : Launch a Python runtime from the specified company and with the specified tag -0 --list : List the available pythons -0p --list-paths : List with paths If no options are given but a script is specified, the script is checked for a shebang line. Otherwise, an active virtual environment or global default will be selected. See https://docs.python.org/using/windows.html#python-launcher-for-windows for additional configuration. The following help text is from Python: usage: C:\Python312\python.exe [option] ... [-c cmd | -m mod | file | -] [arg] ... Options (and corresponding environment variables): -b : issue warnings about converting bytes/bytearray to str and comparing bytes/bytearray with str or bytes with int. (-bb: issue errors) -B : don't write .pyc files on import; also PYTHONDONTWRITEBYTECODE=x -c cmd : program passed in as string (terminates option list) -d : turn on parser debugging output (for experts only, only works on debug builds); also PYTHONDEBUG=x -E : ignore PYTHON* environment variables (such as PYTHONPATH) -h : print this help message and exit (also -? or --help) -i : inspect interactively after running script; forces a prompt even if stdin does not appear to be a terminal; also PYTHONINSPECT=x -I : isolate Python from the user's environment (implies -E and -s) -m mod : run library module as a script (terminates option list) -O : remove assert and __debug__-dependent statements; add .opt-1 before .pyc extension; also PYTHONOPTIMIZE=x -OO : do -O changes and also discard docstrings; add .opt-2 before .pyc extension -P : don't prepend a potentially unsafe path to sys.path; also PYTHONSAFEPATH -q : don't print version and copyright messages on interactive startup -s : don't add user site directory to sys.path; also PYTHONNOUSERSITE=x -S : don't imply 'import site' on initialization -u : force the stdout and stderr streams to be unbuffered; this option has no effect on stdin; also PYTHONUNBUFFERED=x -v : verbose (trace import statements); also PYTHONVERBOSE=x can be supplied multiple times to increase verbosity -V : print the Python version number and exit (also --version) when given twice, print more information about the build -W arg : warning control; arg is action:message:category:module:lineno also PYTHONWARNINGS=arg -x : skip first line of source, allowing use of non-Unix forms of #!cmd -X opt : set implementation-specific option --check-hash-based-pycs always|default|never: control how Python invalidates hash-based .pyc files --help-env: print help about Python environment variables and exit --help-xoptions: print help about implementation-specific -X options and exit --help-all: print complete help information and exit Arguments: file : program read from script file - : program read from stdin (default; interactive mode if a tty) arg ...: arguments passed to program in sys.argv[1:]