How to check the Numpy version on linux, mac and windows:
Numpy package is used for scientific computation in python. It is easy to install numpy and use. In this post, I will show you how to check the installed numpy version in linux, mac or windows.
Method 1: Using numpy.version :
numpy.version holds the version number of currently installed numpy. Create one .py file with the below code:
import numpy
print(numpy.__version__)
Executing it will print the numpy version.
Or, if you don’t want to create a new file just to check the version of a library, you can directly copy paste the below command on a terminal :
python -c "import numpy; print(numpy.__version__)"
It does the same thing.
Method 2: Using pip:
Using pip, we can get version list of all the packages installed in our system.
For python3, you can use pip3 or simply pip for python2.
pip3 list
It lists all package list with its version number.
Package Version
----------- -------
autopep8 1.5.4
decorator 4.4.2
numpy 1.19.1
patool 1.12
Pillow 8.0.1
pip 20.1.1
pycodestyle 2.6.0
setuptools 49.2.0
Or, we can simply use:
pip3 show numpy
Or,
pip3 freeze | grep numpy
It will give only the version number.
numpy==1.19.1
You might also like:
- How to convert a python string to hexadecimal value
- Python string lower() method explanation with example
- Python string upper() method explanation with example
- IntEnum in python explanation with example
- Python program to check two integer arrays contains same elements
- Python numpy append method explanation with example