Multiple versions of Python coexisting in the same OS

Edward Diener eldiener at tropicsoft.invalid
Sun Jul 25 15:33:00 EDT 2010


On 7/25/2010 10:31 AM, News123 wrote:
> On 07/25/2010 02:46 PM, Edward Diener wrote:
>> On 7/25/2010 6:07 AM, Gelonida wrote:
>
>>> There the windows solution could be something like a small 'pystarter'
>>> program, which would decide depending on the file's location / the
>>> file's first line which python should be started.
>>
>> This does not work when Python is invoked internally via a file
>> association. That was the point of my saying that the simple solutions
>> do not work.
>
> I'm not sure I understand. The ida is of course, that the file
> association would point to the pystarter and that pystarter would
> depending on directory / first line of the script
> identify the correct executable to be started with.
>
>
>
> Perhaps you could once more explain, what your intended solution would be.

How does a 'pystarter' program know where the file's location is which 
is being invoked ? As to the first file line this is completely 
unrealistic. What are you going to do, alter the first file line of 
every script in a Python distribution and every script in every library 
installed in a Python distribution ? Sorry, but a less intrusive 
solution is much better and much less of a headache to say the least.

My intended solution would be a simple program which understands where 
each co-existing Python distribution is installed on a system and what 
the "name" of that distribution is. Then you tell the program which 
Python distribution should be the current one by its "name", the current 
one meaning the distribution which you want to be invoked at any given 
time. The program then changes the PATH so that any references to the 
Python directory and its subdirectories point to the "name" Python 
directory tree, and changes the file associations so that the "name" 
Python executables handle the Python associations.

This does have the weakness that I can not use more than one Python 
distribution while Python is executing scripts. But I can personally 
live with that since I have never encountered a situation where I must 
use more than one Python distribution at the same time.





More information about the Python-list mailing list