user1748601
user1748601

Reputation: 177

I am trying to import numpy for use in a Python script but I get the error "No module named numpy"

I am using MinGW on a 64-bit Windows machine. I am using Python 2.6.8. When I try to install numpy from http://sourceforge.net/projects/numpy/files/NumPy/ , the error comes up that it cannot find Python2.6 in the registry. Please walk me through what I should do.

Upvotes: 1

Views: 1575

Answers (1)

jdotjdot
jdotjdot

Reputation: 17062

Do you have pip installed? That would generally be the best way to install it.

With pip

If you don't have pip, do the following:

  1. Run curl http://python-distribute.org/distribute_setup.py | python. This provides you with tools you'll need to install the package manager.
  2. Run curl https://raw.github.com/pypa/pip/master/contrib/get-pip.py | python. This installs the package manager.

Then run pip install numpy, and it should install for you.

If that doesn't work

Sometimes on Windows machines, installing more complex Python packages throws errors like Unable to find vcvarsall.bat or gcc exited with status code 1 or something along those lines, which are compilation errors. You can get around that by installing unofficial pre-compiled binaries, by running

easy_install http://www.lfd.uci.edu/~gohlke/pythonlibs/2kgjgnai/numpy-MKL-1.6.2.win-amd64-py2.6.exe

That installs a pre-compiled optimized binary of Numpy. This isn't as perfect as installing it straight from the index, and sometimes there can be minor incompatibilities, but it should be fine for most purposes.

After this is completed, you should be able to import numpy without issue.

Upvotes: 1

Related Questions