How can I check the version of Python package from the command line for these installed modules?

How can I check the versions of Python packages installed using setuptools?

I installed the Python packages construct and statlib using setuptools with the following commands:

sudo apt-get install python-setuptools
sudo easy_install statlib
sudo easy_install construct

How can I check the version of Python package from the command line for these installed modules?

Using pip show command: You can use pip show to display details about the installed package, including its version.

pip show statlib
pip show construct

Alternatively, you can run the following command with Python -m to check the version of the installed package.

-m pip show statlib
-m pip show construct

Using Python code: You can also check the version of the package directly in a Python script or interactive shell:

import statlib
print(statlib.__version__)

import construct
print(construct.__version__)