I am confused about the standard way to write the shebang for a Python script.
I have a plain "python" link which depending on the system it could be either Python 2.x or Python 3.x and that is a problem since both are incompatible.
As a solution I write the version in my shebang and have something like:
#!/bin/env python3.2
But that seems foolish because it will prevent my script from running in any other 3.x release
I have noticed that some systems have python2 linked to the latest release. That helps, since that way I could write simple scripts, like "Hello World" which will not break with every release.
I have installed Python 2.6, 2.7, 3.1 and 3.2 Using just "python" for the shebang does not make sense from a portability point of view. Using the exact version hinders maintainability. I do have a python2 link, but not not a python3
Is there any standard and/or PEP specifying how Python should be installed? And one that says that I deploy to must have a python3 and/or python2 linked to the latest release?
Almost anything that works with Python 2.x works with Python 2.7 unchanged. The same goes with Python 3.x and Python 3.2. Anything that doesn't should be changed (no really, it should).
Then it's simply the usual naming scheme:
#!/usr/bin/env python
#!/usr/bin/env python3
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With