Numpy

How to Install a Specific Version of NumPy: 3 Steps Only

There may be cases when the programmer gets an error while using the NumPy function. And mostly it’s due to the case that the current version of the NumPy may not be supported by the python interpreter. Thus, it’s better that you should install a specific version of NumPy to resolve the error. In this post you will know how to install a specific version of NumPy with steps.

Steps to install a specific version of numpy

Let’s explore all the steps to install a specific version of numpy through steps.

Step 1: Open your terminal

The first step is to open your terminal according to your operating system. For example, on Windows open the command prompt or PowerShell. And if you are using macOS or ubuntu then open the terminal.

Step 2: Use the pip to install NumPy

After opening the terminal or command prompt you have to use the pip command to install the specific version of NumPy. But before that you should also check the version of the python installed in your system. If you are using python 3. xx version then use the pip3 command and if it is 2.xx version then use the pip command.

The syntax for installing the specific version of the NumPy is below.

pip install numpy==<desired_version_number>

Suppose I want to install the NumPy 1.26 version then I will use the below command.

For python 3.xx

pip3 install numpy==1.26.1

For python 2.xx

pip install numpy==1.26.1

Step 3: Verify the installation

After installing the specific version of the NumPy it’s not time to check the version of the NumPy installed in your system. For that you will use the lines of code below.

import numpy as np
print(np.__version__)

Output

verified installation of numpy

Conclusion

NumPy is mostly used in python packages for complex mathematical calculations. Sometime developers require to install a specific version of the NumPy module. The above steps will allow you to install any version of the NumPy using the pip command. You can also check the version of the NumPy using step 3.

I hope you have liked this tutorial. If you have any queries then you can contact us for more help.