[Numpy-discussion] numpy installed but can' use

Travis E. Oliphant oliphant@enthought....
Fri Dec 28 22:38:45 CST 2007


dikshie wrote:
> On Dec 29, 2007 1:57 AM, Christopher Barker <Chris.Barker@noaa.gov> wrote:
> 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
>> numpy.__version__
>>     
>
>
> so import numpy and from numpy import *
> are different ?
>   

Yes, the key is what "names" are "imported" into the current namespace 
(what names are visible to your code).

import numpy

loads the module and places the name "numpy" in the current namespace 
which points to the loaded module. 

from numpy import *

loads the module and places all the "exported" names from numpy into the 
current namespace.  The list of exported names, however, does not 
include the module numpy itself and so the current namespace does not 
get a "numpy" entry.

-Travis O.



More information about the Numpy-discussion mailing list