maintain 2 versions of python on my computer

Sridhar Ratnakumar sridharr at activestate.com
Sun Jan 17 12:31:07 EST 2010


On 1/14/2010 3:23 PM, Lie Ryan wrote:
> On 01/14/10 22:21, luis wrote:
>> >
>> >  Hi
>> >
>> >  I am not an expert in programming and using Python for its simplicity
>> >
>> >  I have 2 versions of python installed on my computer (windos xp) to
>> >  begin the transition from version 2.4 to 2.6 or 3. maintaining the
>> >  operability of my old scripts
>> >
>> >  Is there any way to indicate the version of the python interpreter
>> >  must use a script?
>> >
>> >  thanks
> On my Windows machine, I make a copy python.exe and rename it as
> python25.exe, python26.exe, python3.exe, etc in their respective
> directories. Then after setting up the PATH environment variable, you
> can simply call python25, python3, etc from any directory in the command
> prompt.

Lie, ActivePython does both of this during the installation -- 
pythonXY.exe and set PATH accordingly.

Luis, Distribute (a setuptools fork) has a feature called "entry points" 
that will create exe wrappers for the specified Python script. These exe 
wrappers use the #! line to determine the actual Python interpreter to 
invoke.

 
http://packages.python.org/distribute/setuptools.html#automatic-script-creation

If your script is foo-script.py, foo.exe will ultimately read the first 
line in foo-script.py which is #!C:\Python26\python.exe .. and that is 
used to run the script. Task manager will show "foo.exe" instead of 
"python.exe".

-srid



More information about the Python-list mailing list