更新时间:2023-12-01 19:18:46
在shebang行上可以有参数,但是大多数操作系统的参数很小限制参数数量。 POSIX仅要求支持一个参数,这在包括Linux在内都是常见的。
You can have arguments on the shebang line, but most operating systems have a very small limit on the number of arguments. POSIX only requires that one argument be supported, and this is common, including Linux.
由于您使用的是 / usr / bin / env
命令,您已经在 python
中用完了一个参数,因此不能添加另一个参数 -u
。如果要使用 python -u
,则需要将绝对路径硬编码为 python
而不是使用 / usr / bin / env
,例如
Since you're using the /usr/bin/env
command, you're already using up that one argument with python
, so you can't add another argument -u
. If you want to use python -u
, you'll need to hard-code the absolute path to python
instead of using /usr/bin/env
, e.g.
#!/usr/bin/python -u
请参阅以下相关问题:如何在shebang中使用多个参数(例如#!)?
See this related question: How to use multiple arguments with a shebang (i.e. #!)?