Home » Python

How to check version of python modules?

Python | checking version of modules: Here, we are going to learn how to check version of python modules?
Submitted by Sapna Deraje Radhakrishna, on February 01, 2020

The ideal way of installing python libraries are using PIP (Python Package Manager). PIP provides an option to verify the version of the installed modules.

The command to use to verify the version of the installed modules is:

    pip freeze
(venv) bash$:src XYZ$ pip freeze
notebook==6.0.2
numpy==1.17.2
openpyxl==3.0.2
pandas==0.25.3
pandocfilters==1.4.2
parso==0.5.2
pexpect==4.7.0
pickleshare==0.7.5
prometheus-client==0.7.1
prompt-toolkit==3.0.2
ptyprocess==0.6.0
Pygments==2.5.2
pynb==0.1.36
pyrsistent==0.15.6
python-dateutil==2.8.1
pytz==2019.3
pyzmq==18.1.1
qtconsole==4.6.0
Send2Trash==1.5.0
six==1.13.0
soupsieve==1.9.5
SQLAlchemy==1.3.12
terminado==0.8.3
testpath==0.4.4
tornado==6.0.3
traitlets==4.3.3
wcwidth==0.1.8
webencodings==0.5.1
widgetsnbextension==3.5.1

The above list might be very exhaustive and in order to verify the version of a given module use the below command,

(venv) bash:src XYZ$ pip freeze | grep pandas
pandas==0.25.3

Another option to verify the version of the module (without using PIP) is as follows,

# import the module 
import pandas as pd 

# print the version 
print(pd.__version__)

Output

0.25.3

The above method is cumbersome in case we want to verify the version of multiple modules, as we have to write a print statement for every module. Hence the PIP way of verifying the version is preferred.






Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.





Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates


© https://www.includehelp.com some rights reserved.