Launching a Script on the Linux Platform

Chris Angelico rosuav at gmail.com
Mon Nov 18 13:09:07 EST 2019


On Tue, Nov 19, 2019 at 5:06 AM Wildman via Python-list
<python-list at python.org> wrote:
>
> On Sun, 17 Nov 2019 18:27:45 +0000, Barry Scott wrote:
>
> >> On 12 Nov 2019, at 20:24, Wildman via Python-list <python-list at python.org> wrote:
> >>
> >> Yes, I prefer to envoke env in the shebang line instead of
> >> depending on the path.  Paths can change especially in a
> >> multi-user system but env will always know where to find
> >> the executable.
> >
> > The path to python will not change surely?
>
> In Linux, being a multi-user OS, the path is not global or
> system wide.  The path can be different for different users.
> This is done by adding an EXPORT command to ~/.bashrc.
>
> > Because you are installing from a deb you know the exact path to the python you
> > need to use. There is no need to use the /usr/bin/env to search the path and
> > potential break your code, because a version of python that you do not expect is on
> > the path.
> >
> > Barry
>
> I don't understand.  The deb does not install python so I
> fail to see how I would know the exact path.
>
> As to env breaking my code, never heard of such a thing.
>

The deb should depend on an appropriate Python package. Then you can
assume and expect that this version of Python is installed.

ChrisA


More information about the Python-list mailing list