Open In App

Different Ways of Installing Python’s Numpy on Linux

Last Updated : 08 Oct, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

Numpy is a python library that is very popular in the field of data science because it makes the task of data processing very efficient, unlike conventional arrays. If you want to learn more about Numpy, please refer to this article.

Before we start with the installation steps, we have to make sure that your system has python installed.

Type the following command in the terminal   (To open the terminal, press Ctrl + Alt + T)

$ python --version

If the output of the command is a valid python version, then you have python installed in your system.

Example Output:

Python 3.8.10

But if you don’t have Python installed in your system, there’s nothing to worry about. You can install Python using the following commands.

$ sudo apt-get update
$ sudo apt-get install python3

Now that you have successfully installed python in your system, we can start installing Numpy

Method 1: Using PIP to install NumPy on Linux

Follow the below steps to install Numpy on Linux:

  • Open a new terminal

  • Enter the following command in your terminal
$ pip install numpy
  • After the installation is complete, you can test if it was correctly installed using the following commands.
$ pip show numpy

Using PIP to install NumPy on Linux

  • There is an alternate way of checking
$ python

>>> import numpy as np
>>> np.__version__

Example Output:-

'1.17.4'

Method 2: Using Anaconda-Navigator to Install Numpy on Linux

Follow the below steps to install Numpy using anaconda-Navigator:

  • Open a new terminal window and enter the command given below
$ anaconda-navigator

Anaconda Navigator

  • After the Anaconda-Navigator is finished loading click on the Environments tab
  • Now we will create a virtual environment to install Numpy but if you don’t want to do that you can just install Numpy in your base(root) environment by skipping the steps of creating a virtual environment
  • Click on the “Create” button at the bottom of the navigator

  • Now choose a name for your virtual environment and a Python version then click on “Create”

  • Select your virtual environment and search for “Numpy” in the search bar

  • Click on Apply

Using Anaconda-Navigator to Install Numpy on Linux

  • Again click on apply and wait for the completion of the installation process
  • Now we will check if the installation was successful or not
  • Click on the PLay button next to the name of your virtual environment and choose “Open Terminal”

  • In the terminal type the following command:
$ pip show numpy
Verifying Numpy Installation on Linux

If your output is similar to this your installation was successful

Method 3: Using conda to Install Numpy on Linux

Follow the below steps to install Numpy on Linux using conda:

  • Open a new terminal window and enter the command given below
$ conda activate base

activate coda environment

  • Now type the following command to install  Numpy
$ conda install numpy

Using conda to Install Numpy on Linux

  • Press the enter key to continue the installation
  • After the installation is completed you can verify the installation using the following command
$ pip show numpy

Using conda to verify Numpy Installation on Linux

You can install other libraries through Anaconda using the same process.

Congratulations, at this point you have completed the installation process successfully.


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads