Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

Install NumPy for Python on Windows and Linux

Check Python and pip, then install NumPy with one command.

How-To Guides1 min read8 screenshots

Windows

Step 1: Check Python

python --version
The Python version

If Python is not installed, install it from python.org and tick Add python.exe to PATH.

Step 2: Check pip

pip --version
The pip version

Step 3: Install NumPy

pip install numpy
Installing NumPy

Step 4: Check it

Open Python and run:

import numpy
print(numpy.__version__)
The NumPy version

Linux

Step 1: Check Python

python3 --version
The Python version on Linux

If it is missing:

sudo apt install python3

Step 2: Check pip

pip3 --version
The pip version on Linux

If it is missing: sudo apt install python3-pip.

Step 3: Install NumPy

pip3 install numpy

If you need another package index (a mirror), give its address:

pip3 install numpy --index-url https://pypi.org/simple
Installing NumPy on Linux

On new Debian and Ubuntu systems pip may say externally-managed-environment. Use a virtual environment:

python3 -m venv venv
source venv/bin/activate
pip install numpy

Step 4: Check it

import numpy
print(numpy.__version__)
The NumPy version on Linux

A quick example

import numpy as np

a = np.array([1, 2, 3])
print(a * 2)

Quick recap

  • pip install numpy (or pip3 install numpy).
  • Use a virtual environment on new Linux systems.
  • Check with numpy.__version__.