running python 2 vs 3

Alan Meyer ameyer2 at yahoo.com
Thu Mar 20 15:53:52 EDT 2014


On 3/20/2014 11:21 AM, Marko Rauhamaa wrote:

> On a linux box, the initial line of the script indicates the
> interpreter:
>
>     #!/usr/bin/env python2
>
> for Python 2.x
>
>     #!/usr/bin/env python3
>
> for Python 3.x.
>
> All tutorials will tell you to start it with
>
>     #!/usr/bin/env python
>
> which will start python2 on all (?) existing linux distros, but is
> expected to start python3 within the next decade.
>
>
> Marko

I presume it would still be a good idea to test both python interpreters 
against any script that you didn't knowingly write with a feature that 
will only work in one of the two python versions.

If it works fine in both - and many will, then use:

      #!/usr/bin/env python

Only use the "python2" or "python3" versions if you really have a reason 
to do so.

Yes?  No?

    Alan



More information about the Python-list mailing list