There are multiple ways to find python module version however when you have installed multiple python versions itself, checking and remembering which version is used where could be troublesome task.
There is simple solution. Just login to python inteactive environment for required python version and import modules
$ python3.6 Python 3.6.4 (default, Jan 13 2018, 12:02:51) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import numpy as np >>> np.__version__ '1.14.0' >>> import matplotlib >>> matplotlib.__version__ '2.1.2' >>>
Here is output for python 2.7
$ python Python 2.7.12 (default, Dec 4 2017, 14:50:18) [GCC 5.4.0 20160609] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import numpy as np np.>>> np.__version__ '1.13.0' >>> import matplotlib >>> matplotlib.__version__ '2.0.2' >>>
There are other way to get versions of all installed modules
# This gives output for python2.7.X pip freeze > reqs.txt # This gives output for python3.5.X pip3 freeze > reqs3.txt #This gives output for python3.6.X python3.6 -m pip freeze > reqs3.6.txt