How do I check in Ubuntu 16.04, which version of aiohttp is installed?
This works
python -V
Python 2.7.12
but this doesn't
aiohttp -V
-bash: aiohttp: command not found
How do I check in Ubuntu 16.04, which version of aiohttp is installed?
This works
python -V
Python 2.7.12
but this doesn't
aiohttp -V
-bash: aiohttp: command not found
A general way that works for pretty much any module, regardless of how it was installed is the following:
$ python -c "import aiohttp; print(aiohttp.__version__)"
2.3.3
What this does is run a Python interpreter, import the module, and print the module's __version__
attribute. Pretty much all Python libraries define __version__
, so this should be very general (especially since __version__
is recommended by PEP8).
This is analogous to:
$ python
>>> import aiohttp
>>> print(aiohttp.__version__)
2.3.3
>>> quit()
It is not a command line tool. That's why it says command not found
. It is a pip
package. So, you can do this:
pip freeze | grep aiohttp
to find the version.
If you installed it with pip
(>= 1.3), use
$ pip show aiohttp
For older versions,
$ pip freeze | grep aiohttp
pip freeze
has the advantage that it shows editable VCS checkout versions correctly, while pip show
does not.
... or
$ pip list | grep aiohttp
$ pip list --outdated | grep aiohttp
(--outdated
to see Current and Latest versions of the packages).
Credits: Find which version of package is installed with pip
Note: the property __version__
comes in handy, but it is not always available. This is an issue that evolved with time. YMMV.