![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to check version of python modules?
When you install Python, you also get the Python package manager, pip. You can use pip to get the versions of python modules. If you want to list all installed Python modules with their version numbers, use the following command:
$ pip freeze
You will get the output:
asn1crypto==0.22.0 astroid==1.5.2 attrs==16.3.0 Automat==0.5.0 backports.functools-lru-cache==1.3 cffi==1.10.0 ...
To individually find the version number you can grep on this output on *NIX machines. For example:
$ pip freeze | grep PyMySQL PyMySQL==0.7.11
On windows, you can use findstr instead of grep. For example:
PS C:\> pip freeze | findstr PyMySql PyMySQL==0.7.11
If you want to know the version of a module within a Python script, you can use the __version__ attribute of the module to get it. Note that not all modules come with a __version__ attribute. For example,
>>> import pylint >>> pylint.__version__ '1.7.1'
Advertisements