[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Obtain Python version number



Le mar 8 août 2006 06:54, Andreas Tille a écrit :
> Hi,
>
> to write a wrapper script I wonder what might be the best possibility
> to find out the version numer of the running python interpreter. The
> wrapper script is of the type
>
>    /var/lib/python-support/python${PYVER}/${package}/${realscript}
>
> and I wonder, how I can obtain ${PYVER} according to the version
> of the python binary that is installed as /usr/bin/python.
>
> I tried
>
>    PYVER=`python -V 2>&1 | sed
> 's/Python[[:space:]]\+\([0-9]\+\.[0-9]\+\).*/\1/'`
>
> which works in principle but I wonder if there is some other
> reasonable way.

pyversions -vd will answer the short versions (2.3 today)
pyversions -d will answer python2.3

pyversions -s / -vs do the same with the supported versions.

It indeed is the preferred way to obtain those
-- 
·O·  Pierre Habouzit
··O                                                madcoder@debian.org
OOO                                                http://www.madism.org

Attachment: pgpe8ExP1eFv_.pgp
Description: PGP signature


Reply to: