Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 5 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.

share|improve this answer

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

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

small problem solved. general problem forgotten

share|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
For numpy, you need print numpy.version.version. – daviewales May 29 '14 at 7:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .