/usr/bin/env python, force a version

manatlan at gmail.com manatlan at gmail.com
Thu Oct 6 13:25:29 CEST 2005

I've got a trouble, and i think that anybody there can help me

I've got a python script which i distribute in somes packages for *nix.
This script is full of python and need python 2.4 ! And i'd like to
display a message when the user doesn't have a python2.4 version.

if i put, at the top of the script (which can be done with /usr/bin env

it will be good, but py2.3 users can't run the script, and the message
comes from the system ;-( ... it can't be a message from my script ;-(

it will not be good, because my scrill will not work at all ;-)

it will select the defined python version of the platform ... And here
is the problem. On debian/sid, users have python2.3 (default), et py2.4
: So the script will start with 2.3, and my message will be displayed.
But it could work because there is a py2.4 on the machine ;-(.

I'd like to make my script (or a starter script)
which will be able to detect all python versions of the machine. And
run my script with the good one ; py2.4, or display a message to the
user to say her it must install py2.4 ...

I hope you understand my needs. Is there a python/bash mechanism to
override the default python version of the system ...  and run the
script with any version of python (but the most recent) ?
or can you explain me how to do that ? the simplest way ?

More information about the Python-list mailing list