3

I have installed the pysnmp module in Linux.

I want to know which version of the pysnmp is got installed. How can I see the pysnmp version through the Linux terminal..? pysnmp -V did not work.

I haven't pip installed in my linux, so pip show pysnmp is also not working..

Sabin Chacko
  • 713
  • 6
  • 17
  • 1
    Possible duplicate of [How to check version of python modules?](http://stackoverflow.com/questions/20180543/how-to-check-version-of-python-modules) – Andy K Apr 28 '16 at 08:46

2 Answers2

3

You can also check a module's version from inside a Python interpreter:

>>> import pysnmp
>>> pysnmp.__version__
'4.3.2'

To do this from a shell, just execute it through python -c.

$ python -c "import pysnmp; print(pysnmp.__version__)"
'4.3.2'

This executes a string upon starting the Python interpreter from the shell, allowing you to easily run short commands without writing a new script file or loading an interactive intepreter.

Alex Huszagh
  • 13,272
  • 3
  • 39
  • 67
1

You can try that

pip show pysnmp 

Or any version you want actually

pip show YOUR_PACKAGE_NAME | grep Version
Andy K
  • 4,944
  • 10
  • 53
  • 82
  • I don't have pip installed in my linux. so it doesn't recognize the pip command.. – Sabin Chacko Apr 28 '16 at 08:53
  • Hi @SabinChacko, that's an interesting one. How do you install your version then? – Andy K Apr 28 '16 at 08:56
  • I installed the library manually.. downloading the zip from sourceforge.net, extracting and at last executing python `setup.py install` .. I knew the version since I installed it manually but I needed to display it.. – Sabin Chacko Apr 28 '16 at 09:02
  • omg @SabinChacko the olds ways ... :) Have a try with pip for your next install. It is time and energy saving. – Andy K Apr 28 '16 at 09:02
  • Yea.. I don't know.. sometimes we need to get things done at any cost.. :p And the most weird fact is that I'm installing this for a php program.. :p – Sabin Chacko Apr 28 '16 at 09:03