I have a python program which I have made work in both Python 2 and 3, and it has more functionality in Python 3 (using new Python 3 features).
My script currently starts #!/usr/bin/env python
, as that seems to be the mostly likely name for a python executable. However, what I'd like to do is "if python3 exists, use that, if not use python".
I would prefer not to have to distribute multiple files / and extra script (at present my program is a single distributed python file).
Is there an easy way to run the current script in python3, if it exists?