[Tutor] how can i use python 2 alongside 3?

Oscar Benjamin oscar.j.benjamin at gmail.com
Thu Jan 24 21:30:42 CET 2013


On 24 January 2013 20:14, Matthew Ngaha <chigga101 at gmail.com> wrote:
>>
> thanks Dave. the file was py.exe as you said and the temporary path is
> able to open both version 2 and 3's  python.exe. There seems to be a
> problem. python 2 seems to be the only version opening my files unless
> i do a few things. So with the shebang set:
>
> the python launcher, launches my python 3 files with the correct
> version if i double click the file or run it from a console. But it
> uses the wrong version if i run it from IDLE or if i right click the
> file and open with the Python Launcher. i guess i can live with that,
> but is there anyway around this?

Each version of Python has it's own version of IDLE. If you use the
IDLE that came with Python 2 it will always run in Python 2. I think
the same is true for the "Python launcher". Probably you have more
than one version of these programs installed. You could create
shortcuts (or something like that) to run the Python 3 versions. In
any case, this is the reason that the py.exe launcher was created, so
that you could have one launcher that would run each script in the
appropriate version of Python.


Oscar


More information about the Tutor mailing list