Say I have python-twisted installed.

sudo apt-get -V check python-twisted

does not show the version number, just

Reading package lists... Done
Building dependency tree       
Reading state information... Done

How do I get apt-get to print the currently installed version number for an application?

link|improve this question
feedback

2 Answers

up vote 2 down vote accepted

apt-get is the wrong tool for that.

dpkg -l python-twisted shows the version number as part of a human-friendly listing with possibly truncated columns. For parseable output, use dpkg-query -W python-twisted, or dpkg-query -W -f '${version}\n' python-twisted to get just the version number.

apt-cache policy python-twisted shows what version of the package is installed as well as any version that is available for installation.

These are all about deb package versions, not python library module versions. The package version often follows the library module version, but it's not an obligation.

link|improve this answer
feedback

I figured out you can get the version number of a python package (not anything) by just saying

python
>>> import twisted
>>> print twisted.version
[twisted, version 10.0.0]

small problem solved. general problem forgotten

link|improve this answer
Then you asked the wrong question. This topic might still be interesting for others; try to accept a solution for your original question if someone posts it. – Daniel Beck Dec 14 '10 at 18:15
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.