Use --modversion
.
$ pkg-config --modversion python
2.7
pkg-config is meant to be used when compiling against a library -- if you're trying to check the version of a package, use dpkg -s
$ dpkg -s firefox
Package: firefox
Status: install ok installed
Priority: optional
Section: web
Installed-Size: 48531
Maintainer: Ubuntu Mozilla Team <ubuntu-mozillateam@lists.ubuntu.com>
Architecture: amd64
Version: 17.0.1+build1-0ubuntu0.12.04.1
Or apt-cache policy
$ apt-cache policy firefox
firefox:
Installed: 17.0.1+build1-0ubuntu0.12.04.1
Candidate: 20.0+build1-0ubuntu0.12.04.3
...