Introduction
NumPy(Numerical Python) is a library for the Python programming language, adding support for large, multi-dimensional arrays and matrices, along with a large collection of high-levelmathematicalfunctions to operate on these arrays.
The ancestor of NumPy, Numeric, was originally created by Jim Hugunin with contributions from several other developers. In 2005, Travis Oliphant created NumPy by incorporating features of the competing Numarray into Numeric, with extensive modifications. NumPy is open-source software and has many contributors. NumPy is a NumFOCUS fiscally sponsored project.
Apart from its multi dimensional array object, it also provides high-level functioning tools for working with arrays.
In this tutorial, you will learn how to install NumPy.Â
Installation
Just follow the steps below
Note: You can follow this article if you have python2 installed on your Ubuntu system. Most likely, you have Python 2 or Python 3 installed, or even both versions you can follow it.
- So, Install python3 and make python command acts as python3 command.
sudo apt install -y python-is-python3 python3
- Also Check Python Version
python -V
If you want to update the python 3.8 to python 3.9 version, follow this installation guide Install python3.9 on Ubuntu
- Install pip3.
sudo apt install python3-pip
Note:
Pip a package manager for installing and managing Python software packages.
The easiest way to install NumPy is by using Pip unlike Python, Pip does not come preinstalled on most operating systems. Therefore, you need to set up the package manager that corresponds to the version of Python you have.
- Also, Verify you have installed Pip with command.
pip3 -V
- Next, Install NumPy with Python3 with below command
pip3 install numpy
- Use the show command to verify whether NumPy is now part of you Python packages.
pip3 show numpy
- Import the numpy package and set an alias for it.
python3
- Import the new package and add an alias for it (for example: num) with command
import numpy as num
- Exit the python3 shell with exit() or just press ctr-D
Note: If you already have numpy on your system and want to upgrade it, run the command below
pip3 install --upgrade numpy
Conclusion
So, In this installation guide, we illustrated how to install numpy(Numerical Python) a library for python on Ubuntu system.
Thank you !!!
Thank you very much for this very detailed, step by step from the start tutorial. With my best regards