NumPy Installation-
If Python and PIP is already installed on a system, then installation of NumPy can be done by using following command
pip install numpy
In case if the above mentioned command fails, then use a python distribution that already has NumPy installed like, Anaconda, Spyder etc.
NumPy Importing-
To import NumPy in our application code use import keyword as shown in following command-
import numpy
NumPy is usually imported under the np
alias, as shown in below example-
import numpy as np
arr = np.array([1, 2, 3])
print(arr)
Output
[1 2 3]
How to check the version of NumPy?
Attribute __version__ stores the version key of NumPy. It can be used as shown below-
import numpy as np
print(np.__version__)
Leave a Reply