5

I tried importing NumPy to carry out some array operations in Python:

import numpy *

But I got this error message:

ModuleNotFoundError: No module named 'numpy'

What do I do?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
user3576608
  • 61
  • 1
  • 1
  • 3
  • 2
    [the official installation instructions](https://docs.scipy.org/doc/numpy/user/install.html) may be of use. – Him Jan 03 '20 at 08:10
  • 2
    You have not installed numpy module or you are using the wrong python installation. – Frieder Jan 03 '20 at 08:13
  • 2
    Possible dublicate of https://stackoverflow.com/questions/7818811/import-error-no-module-named-numpy – Scott Jan 03 '20 at 08:16
  • The canonical question for this problem on Windows may be *[Error "Import Error: No module named numpy" on Windows](https://stackoverflow.com/questions/7818811/)* (2011, 40 answers and 300 votes). – Peter Mortensen Aug 22 '22 at 15:07

5 Answers5

5

If you are using PyCharm, open PyCharm and go to menu FileSettingProjectPython Interpreterclick on '+' → search and select the required package → install package.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Akhila M
  • 51
  • 1
  • 2
3

Use the following command

pip3 install numpy

You will get the following response. You see the location.

Use the following as PATH as per direction explained in the previous post.

Requirement already satisfied: numpy in c:\users\-user name-\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (1.20.1)

NumPy is installed here, not in "scripts".

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
1

NumPy doesn't seem to be installed on your computer, but you can use this command to install it:

python -m pip install --user numpy

Or you can check the installation guide for your distribution here: Install SciPy

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
NoaDeKoKo
  • 86
  • 5
0

You can simply install NumPy with pip:

pip install numpy
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Scott
  • 4,974
  • 6
  • 35
  • 62
0

Install NumPy with the pip install numpy command (ignore if already installed).

Import NumPy in either of the three ways:

  • import numpy
  • import numpy as np
  • from numpy import *
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Balraj Ashwath
  • 1,407
  • 2
  • 13
  • 19