Search code examples
pythonlinuxpysnmp

How to see the pysnmp version in Linux terminal without using pip


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..


Solution

  • 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.