How to manage python shebang on mixed systems?

Cameron Simpson cs at cskk.id.au
Mon Nov 7 17:35:07 EST 2022


On 07Nov2022 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?
>
>Wouldn't '#! env python3' be better?

The thing after the shebang needs to be a full path.

"env" is in /usr/bin on damn near everything. I think I had to make a 
symlink on a Solaris system once, but otherwise it has not been a 
problem for me on many different systems for many years.

Cheers,
Cameron Simpson <cs at cskk.id.au>


More information about the Python-list mailing list