How to manage python shebang on mixed systems?

Chris Green cl at isbd.net
Mon Nov 7 16:27:26 EST 2022


Barry Scott <barry at barrys-emacs.org> wrote:
> 
> 
> > On 7 Nov 2022, at 09:28, Chris Green <cl at isbd.net> wrote:
> > 
> > Chris Green <cl at isbd.net> wrote:
> >>> 3: with your pseudo "python3" script in place, make all the scripts use 
> >>> the "#!/usr/bin/env python3" shebang suggested above.
> >>> 
> >> Yes, that sounds a good plan to me, thanks Cameron.
> >> 
> > Doesn't '#!/usr/bin/env python3' suffer from the same problem as
> > '#!/usr/bin/python3' in the sense that the env executable might not be
> > in /usr/bin?
> 
> env is always available as /usr/bin/env - I think its spec'ed in posix that way.
> 
> The only reason that things are in /bin are for systems that need a subset of
> programs to boot the system to point it can mount /usr. env is not going to be
> needed for that use case.
> 
Given that the problem system is running a very old Linux I'm not sure
what chance there is that it's fully posix compliant.

If using "#!/usr/bin/env python3" is a way of avoiding problems if
python3 isn't in /usr/bin then why is it any better depending on env
being in /usr/bin.

-- 
Chris Green
·


More information about the Python-list mailing list