[ale] Slightly OT: System default python version

Charles Shapiro hooterpincher at gmail.com
Thu Jan 25 07:32:43 EST 2018


Another Correct way to specify the interpreter is:

<code>
#!/usr/bin/env python
</code>

Guarantees that you'll get the first "python" in ${PATH}.  On most
Debian-based systems, that is a softlink to the current default version. On
my Slink (yeah, I know, I'm updating soon) it goes to "/usr/bin/python",
which is a symlink to "/usr/bin/python2.7".  It may also be a symlink to a
symlink in /etc/alternatives.

This is really a bash thing rather than a python thing. The trick is to get
the bash interpreter to invoke the correct program to run your script, be
it python, perl, or another language.


-- CHS


On Wed, Jan 24, 2018 at 10:08 PM, DJ-Pfulio via Ale <ale at ale.org> wrote:

> On 01/24/2018 06:03 PM, Todor Fassl via Ale wrote:
> > I got a question from a student who is using python. "I'd rather not
> > hard code in any python version. Is there any reason to have the system
> > default be 2 instead of 3?"
> >
> > He had asked me to install the python-matplotlib package. I was like,
> > "Are you sure you want python-matplotlib and not python3-matplotlib?" He
> > is still coding in python2.7 instead of python3 but not by choice. Is
> > there such a thing as a system default python version? To program in
> > python3, doesn't he have to modify his code?
> >
>
> There are 2 major ways for python versions to be decided.
>
> a) If you are making an application that needs to run on every OS, then
> the developer should specify the exact version necessary and provide any
> libs needed for it. It should be self-contained and not dependent on
> whatever the OS python or OS python libraries happen to be. Ruby and
> perl both provide tools for self-contained deployments in this way.
> Python definitely does as well.
>
> b) If you are making an application to be added to an existing OS, then
> the platform/distro decides the version and everything you code should
> work with that version and the libraries provided for it through the
> package manager.
>
> I read somewhere that Ubuntu will be switching to Python3 as the primary
> platform version in 18.04. https://wiki.ubuntu.com/Python
>
> [quote]All Ubuntu/Canonical driven development should be targeting
> Python 3 right now, and all new code should be Python 3-only.
> [/quote]
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/listinfo
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.ale.org/pipermail/ale/attachments/20180125/685f687f/attachment.html>


More information about the Ale mailing list