Proper shebang for python3
We are using `#!/usr/bin/env python`, for example on
For bash we are using `#!/usr/bin/env bash`. I don't know if those are the
best but they work.
uri at speedy.net
On Sat, Jul 20, 2019 at 9:12 PM Michael Speer <knomenet at gmail.com> wrote:
> You may want to use `#!/usr/bin/env python3` instead.
> There is a concept in python called the virtual environment. This used to
> be done with a tool called virtualenv in python2, and is now done mainly
> through a venv module in python3.
> A virtual environment goes into a directory of your choosing and will have
> its own python3 executable, and pip3 executable, and when you add
> dependencies, they are also placed into the directory structure under your
> chosen directory.
> When you do a `. <directory>/bin/activate` the included source will places
> the virtual environment's bin/ folder at the beginning of your PATH
> environment variable, making it the default python3 when you type it
> without a full path.
> This allows you to run scripts that need different, or even conflicting,
> sets of dependencies without bothering with the underlying linux
> distribution's python installation's modules.
> If you use `#!/usr/bin/python3`, it will always use exactly the system
> version that is installed, and the system's installed modules.
> Your scripts will still default to the system installation if a virtual
> environment is not activated. So you lose nothing by doing it this way, but
> gain a little control from it.
> On Sat, Jul 20, 2019 at 1:41 PM Manfred Lotz <ml_news at posteo.de> wrote:
> > Hi there,
> > Pretty new to python I've got a question regarding the proper shebang
> > for Python 3.
> > I use
> > #!/usr/bin/python3
> > which works fine.
> > Today I saw
> > #!/usr/bin/python3 -tt
> > and was wondering what -tt means.
> > Being on Fedora 30, Python 3.7.3 the man page of python3 doesn't even
> > mention -t.
> > python 2 man page mentions
> > -t Issue a warning when a source file mixes tabs and spaces
> > for indentation in a way that makes it depend on the worth
> > of a tab expressed in spaces. Issue an error when the option is
> > given twice.
> > I guess that -t has the same meaning with python 3.7.3.
> > My questions:
> > 1. Is my guess correct?
> > 2. Is it a bug that it is not mentioned? python3 --help doesn't mention
> > it either.
> > --
> > Manfred
> > --
> > https://mail.python.org/mailman/listinfo/python-list