Why do people write #!/usr/bin/env python on the first line of a Python script?

后端 未结 21 1750
刺人心
刺人心 2020-11-21 06:16

It seems to me like the files run the same without that line.

21条回答
  •  忘了有多久
    2020-11-21 07:11

    This is a shell convention that tells the shell which program can execute the script.

    #!/usr/bin/env python

    resolves to a path to the Python binary.

提交回复
热议问题