-3

I am rather new to python and am trying to run a written script that starts with

import numpy as np

When I run the script, it says it can't find the module numpy.

How do I find and install new modules such as numpy?

Dadep
  • 2,796
  • 5
  • 27
  • 40
OrelL
  • 1
  • 3
  • 6
    Possible duplicate of [How do I install Python libraries?](https://stackoverflow.com/questions/21222114/how-do-i-install-python-libraries) – khelwood Dec 26 '17 at 15:08

2 Answers2

2

The package manager for python (e.g equivalent to apt for Ubuntu) is called pip. When you need to install a package, say numpy, you have to type pip install numpy.

kingJulian
  • 5,601
  • 5
  • 17
  • 30
-1

Installing via pip

python -m pip install --user numpy scipy matplotlib ipython jupyter pandas sympy nose

Install system-wide via a Linux package manager (Ubuntu)

sudo apt-get install python-numpy python-scipy python-matplotlib ipython ipython-notebook python-pandas python-sympy python-nose

Install system-wide via a Mac package manager

Macports:

sudo port install py35-numpy py35-scipy py35-matplotlib py35-ipython +notebook py35-pandas py35-sympy py35-nose

Homebrew:

python -m pip install numpy scipy matplotlib

Reference: https://www.scipy.org/install.html

Sharku
  • 1,052
  • 1
  • 11
  • 24
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/low-quality-posts/20861950) – onur Sep 14 '18 at 12:59
  • @phe oh yes sorry I forgot about that. Give me some time to edit the answer. – Sharku Sep 14 '18 at 13:00