NumPy is a Python package used for numerical computation. NumPy's core data type is the array. NumPy fuctions operate on arrays. NumPy is one of the foundational packages for scientific computing with Python.
Before NumPy's functions and methods can be used, NumPy must be installed. Depending on which distribution of Python you use, the installation method is slightly different.
Install NumPy on Anaconda
If you installed the Anaconda distribution of Python, NumPy comes pre-installed and no further installation steps are necessary.
If you use a version of Python from python.org or a version of Python that came with your operating system, the Anaconda Prompt and conda or pip can be used to install NumPy.
Install NumPy with the Anaconda Prompt
To install NumPy, open the Anaconda Prompt and type:
> conda install numpy
y for yes when prompted.
Install NumPy with pip
To install NumPy with pip, bring up a terminal window and type:
$ pip install numpy
This command installs NumPy in the current working Python environment.
Verify NumPy installation
To verify NumPy is installed, invoke the NumPy's version at the Python REPL. Import NumPy and call the
.__version__ attribute common to most Python packages.
import numpy as np np.version