Should I put #! (shebang) in Python scripts, and what form should it take?

前端 未结 12 1068
感动是毒
感动是毒 2020-11-22 01:27

Should I put the shebang in my Python scripts? In what form?

#!/usr/bin/env python 

or



        
12条回答
  •  無奈伤痛
    2020-11-22 01:57

    It's really just a matter of taste. Adding the shebang means people can invoke the script directly if they want (assuming it's marked as executable); omitting it just means python has to be invoked manually.

    The end result of running the program isn't affected either way; it's just options of the means.

提交回复
热议问题