Proper shebang for python3

Chris Angelico rosuav at gmail.com
Sat Jul 20 18:14:12 EDT 2019


On Sun, Jul 21, 2019 at 5:26 AM Tim Daneliuk <info at tundraware.com> wrote:
> So, no, do NOT encode the hard location - ever.  Always use env to discover the one that
> the user has specified.  The only exception is /bin/sh which - for a variety of reasons -
> can reliably counted upon.

A quick grep through my $PATH shows that there are a number of
executable Python scripts there, including add-apt-repository,
calibre, some lilypond stuff, trash-can management, samba-tool, iotop,
and youtube-dl. If I have a venv active with, say, Python 3.9, then
`/usr/bin/env python` is going to point to Python 3.9. What are the
odds that all those scripts will work with Python 3.9 with no
libraries installed? Why should typing "youtube-dl B7xai5u_tnk" be
affected by a virtual environment, when typing "man youtube-dl"
wouldn't be?? Using env for everything is a terrible idea and one that
will basically make virtual environments useless.

ChrisA



More information about the Python-list mailing list