-
Overview
From google styleguide, Most
.py
files do not need to start with a#!
line.Start the main file of a program with
#!/usr/bin/env python3
(to support virtualenvs) or#!/usr/bin/python3
per PEP-394.This line is used by the kernel to find the Python interpreter, but is ignored by Python when importing modules.
It is only necessary on a file intended to be executed directly.
-
Shebang
A shebang(sha-bang, hashbang, pound-bang, hash-pling) is the character sequence consisting consisting of the characters number sign and exclamation mark (#!) at the beginning of a script.
When a text file with a shebang is used as if it is an execuable in a Unix-like OS, the program loader mechanism parses the rest of the file’s inital line as an interpreter directive.
The form of a shebang interpreter directive is as follow:
#!interpreter [optional-arg]
理解Shebang line: #!/usr/bin/python3
猜你喜欢
转载自blog.csdn.net/The_Time_Runner/article/details/115261088
今日推荐
周排行