env in Python interpreter directives

Start Python scripts with #!/usr/bin/env python3 to run the first python3 command in PATH.

A hard-coded interpreter directive such as #!/usr/bin/python3 always uses the system Python at /usr/bin/python3. This interpreter does not use symbolic links in /usr/local/bin/ and ~/.local/bin/, or a Python interpreter from a virtual environment.

When you start a script with #!/usr/bin/env python3, the env utility searches the PATH variable and runs the first matching python3 executable. This follows a system-wide or user-specific symbolic link and supports virtual environments when their bin directory is first in PATH.

Use the same approach with the unversioned python command when your script must run with #!/usr/bin/env python.

When you package Python scripts as RPM packages, interpreter directives must meet packaging requirements.