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

Obtain Python version number



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.

Kind regards

        Andreas.

--
http://fam-tille.de



Reply to: