According to the Python docs, using #!/usr/bin/env python3 is still the recommended way -- but they admit that it does not always work:
2.4. Miscellaneous
To easily use Python scripts on Unix, you need to make them executable, e.g. with
chmod +x script
and put an appropriate Shebang line at the top of the script. A good choice is usually
#!/usr/bin/env python3
which searches for the Python interpreter in the whole PATH. However, some Unices may not have the env command, so you may need to hardcode /usr/bin/python3 as the interpreter path.
The alternative is then to hardocode the python binary, i.e. /usr/bin/python3 (or python in your case).
python3? I'm still on 20.04 myself. I checked the dependencies online and it still seems to be there: ubuntu-desktop -> software-properties-gtk -> python3 -> python3-minimal:/usr/bin/python3; and ubuntu-server -> software-properties-common -> python3.pythonwith whatever is used to actually install your script.#!pythonwould suffice. You as the author of the code shouldn't worry about where the user keeps the version of Python they'll use to execute it.python3 -> pythonin/usr/binor the like than to muck around tons of shebangs, IMHO.