[Numpy-discussion] numpy installed but can' use

Christopher Barker Chris.Barker@noaa....
Fri Dec 28 10:57:40 CST 2007

dikshie wrote:
>>>> from numpy import *
>>>> numpy.__version__
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> NameError: name 'numpy' is not defined
> any hints ?

yes, you did an "import *", which means "bring all the names in the 
numpy module into this namespace. There is no name: "numpy" in the numpy 
module -- it's the name of the module itself. Try:

import numpy

then you can use the stuff in numpy this way:

MyArray = numpy.array(some_stuff)

Or, if you don't want to type quite so much, use something like:

import numpy as N
MyArray = N.array(some_stuff)

"Namespaces are one honking great idea -- let's do more of those!"
-- http://www.python.org/dev/peps/pep-0020/


Christopher Barker, Ph.D.

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception


More information about the Numpy-discussion mailing list