Python script header

后端 未结 6 1901
名媛妹妹
名媛妹妹 2020-12-04 10:54

The typical header should be

#!/usr/bin/env python

But I found below also works when executing the script like $python ./my_script.p

6条回答
  •  既然无缘
    2020-12-04 11:19

    Yes, there is - python may not be in /usr/bin, but for example in /usr/local/bin (BSD).

    When using virtualenv, it may even be something like ~/projects/env/bin/python

提交回复
热议问题