Don't touch my shebang

后端 未结 5 1690
轻奢々
轻奢々 2020-11-30 04:15

One thing I hate about distutils (I guess he is the evil who does this) is that it changes the shebang line. In other words, the more rational and environment-vars decided s

5条回答
  •  情书的邮戳
    2020-11-30 04:39

    I have no solution to your problem, but I do see some rationale for the current behaviour of distutils.

    #!/usr/bin/env python executes the system's default Python version. That is fine as long as your code is compatible with said version. When the default version is updated (from 2.5 to 3, say) your code or other Python code which references /usr/bin/env may stop working, even though the old Python version is still installed. For that reason it makes sense to "hardcode" the path to the appropriate python interpreter.

    Edit: you are correct in asserting that specifying python2.4 or similar solves this problem.

    Edit 2: things are not as clear cut when multiple installations of the same Python version are present, as Ned Deily points out in the comments below.

提交回复
热议问题