How to install NumPy using very simple steps?
Before installing NumPy, ensure Python is installed in your system.
To check if Python is already installed or not, open the Command Prompt (CMD) or terminal and run
If your Command Prompt (CMD) looks like this, It means Python is installed in your system.
If Python is not installed, download and install it from the official website: python.org.
If Python is installed in your system then let's move on, how to install Numpy.
Open your Command Prompt (CMD) or any terminal and Run the following command to install NumPy:
pip install numpy
How to check Numpy is installed or not?
After installation of Numpy whenever you want to work with Numpy, you have to import Numpy.
To import Numpy simply write:
import numpy
In future, you use Numpy word multiple times. So let's give a nickname to the Numpy library.
For this, we are using as keyword. So we simply write:
import numpy as np
Note: Instead of using np you are free to use any word, like a, b, c, hlo, hey, you name anything.
Check Numpy version:
import numpy as np
print(np.__version__)
Output:
2.1.3
If no errors occur and the version is displayed, NumPy is successfully installed.
Tags:
Leave a comment
You must be logged in to post a comment.