running python 2 vs 3
Dan Stromberg
drsalists at gmail.com
Thu Mar 20 16:38:10 EDT 2014
On Thu, Mar 20, 2014 at 8:21 AM, Marko Rauhamaa <marko at pacujo.net> wrote:
> notbob <notbob at nothome.com>:
>
>> I've installed python 3.3 on my Slack box, which by default comes with
>> python 2.7. I know how to fire up the different IDLE environments, but
>> how do I differentiate between the scripts? IOW, up till now, I've
>> used .py on all my 2.7 files. How do I know not to run a .py in
>> python3 or visa versa? Or do I? What's the excepted convention for
>> differentiating between the two?
>
> 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
Actually, I formerly used /usr/bin/env, but have recently (within the
last couple of years) stopped.
This is because the env trick doesn't play nicely with top IME. Also,
it's a trick.
More information about the Python-list
mailing list