running python 2 vs 3

Mark Lawrence breamoreboy at yahoo.co.uk
Thu Mar 20 14:56:25 EDT 2014


On 20/03/2014 15:21, Marko Rauhamaa 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
>
> which will start python2 on all (?) existing linux distros, but is
> expected to start python3 within the next decade.
>
>
> Marko
>

The above is also true on windows via the 'Python launcher for windows' 
see http://legacy.python.org/dev/peps/pep-0397/

-- 
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.

Mark Lawrence

---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com





More information about the Python-list mailing list