running python 2 vs 3

notbob notbob at
Thu Mar 20 17:00:07 CET 2014

On 2014-03-20, Marko Rauhamaa <marko at> wrote:

> That's a bit of a sore spot.
> 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.

Ahhh! a shabang I understand.  So, I guess the only way, short
of looking at the actual file, is to include the version in the
filename.  Can I safely assume I can run all 2.7 files w/o a shebang
(which I have not, so far, and was wondering how I got away with that)
and only include a py3 shebang in the py3 files, yes/no?  


More information about the Python-list mailing list