maintain 2 versions of python on my computer

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Thu Jan 14 07:26:42 EST 2010


En Thu, 14 Jan 2010 08:21:28 -0300, luis <solisgb at gmail.com> escribió:

> 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?

See http://www.effbot.org/zone/exemaker.htm
It uses the #! line to determine which version to load, resembling the  
Unix way.
(I've written a variant of the same idea but isn't ready yet)

Or, you can always invoke your scripts with an explicit interpreter.  
Create a python24.cmd file containing just this line:

@c:\path\to\python.exe %*

(and a similar one for 2.6 and 3.0) and put them somewhere in your path  
(it is convenient to add a single directory to the system PATH for your  
own utilities; I use c:\util; others use c:\bin).

Then you can say:

python26 foo.py

to execute foo.py using Python 2.6

-- 
Gabriel Genellina




More information about the Python-list mailing list