How to Install NumPy on MacOS | Easy NumPy Installation
In this article, we will learn how to install NumPy on MacOS. NumPy is a library for the Python programming language, that adds support for large, multi-dimensional arrays and matrices, along with a large collection of high-level mathematical functions to operate on these arrays.
NumPy Installation in MAC
Python’s NumPy library can be installed on Mac using the pip installer and using the setup.py file.
We have explained the 2 methods with easy-to-follow steps. We will also look at how to verify the clean installation of NumPy.
Method 1: Using pip to install the NumPy Package
Follow the below steps to install the Numpy package on macOS using pip:
Step 1: Install the latest Python3 in MacOS
Step 2: Check if pip3 and python3 are correctly installed.
python3 --version
pip3 --version
Step 3: Upgrade your pip to avoid errors during installation.
pip3 install --upgrade pip
Step 4: Enter the following command to install Numpy using pip3.
pip3 install numpy
Method 2: Using setup.py to install Numpy
Follow the below steps to install the Numpy package on macOS using the setup.py file:
Step 1: Download the latest source package of Numpy for python3 from here.
curl https://files.pythonhosted.org/packages/3a/be/650f9c091ef71cb01d735775d554e068752d3ff63d7943b26316dc401749/numpy-1.21.2.zip > numpy.tar.gz
Step 2: Extract the downloaded package using the following command.
tar -xzvf numpy.tar.gz
Step 3: Go inside the folder and Enter the following command to install the package.
Note: You must have developer tools for XCode MacOS installed in your system
cd numpy-1.21.2
python3 setup.py install
Verifying Numpy installation on macOS:
Try NumPy import in your python terminal to verify if the installation has been done properly:
import numpy
If there is any error while importing the module then is not installed properly.
Contact Us