3 ms·
The ideal approach is "#!/usr/bin/env python3.0".
by Rhamphoryncus 18y ago
The ideal approach is "#!/usr/bin/env python3.0".
- kteague 18y agoIf you install Python 3 with "make fullinstall" then the binary will be named just "python". I've always used just "#!/usr/bin/env python" and just kept track of what version of Python a collection of code was targeted for. Changing all scripts from "#!/usr/bin/env python3.0" to ""#!/usr/bin/env python3.1" and so on is too cumbersome. But it depends upon how you manage your code - whether it's just a few loose scripts, part of a larger project, a web app or a desktop app or a command-line script, or what your deployment and install processes looks like, etc. etc. I usually install my Python scripts with Buildout these days, so I let Buildout autogenerate the shebangs to point to the required Python installation.
- olefoo 18y agoThat solves one slice of the problem, now how do I distinguish between waycoolscript.py written for python3.0 and waycoolscript.py for python2.4? I could live with *.py3 for a few years (remember php3?) but it's kind of a wart. And the thing I like about python is the core teams assiduous avoidance of warts.