Hi Jitse,

I misidentified the problem. Your comment led me to look at my syntax. 
Here's the error:
import numpy as np
v = numpy.zeros(5)
print(v)

I corrected that to:
import numpy as np
v = np.zeros(5)
print(v)
All is well now.

Many thanks for the help!

Ray


On Sunday, December 18, 2016 at 1:42:01 AM UTC-5, Jitse Niesen wrote:
>
> If the numpy library is not available for import, you will get an 
> "ImportError", not a "NameError". I do not see how the statement "import 
> numpy as np" can give you a "NameError". I think the "NameError" is caused 
> by another line in your script. To check, remove the whole script except 
> the first line. 
>
> My guess would be that somewhere in your script, you call some numpy 
> function as "numpy.functionname" while you should call it as 
> "np.functionname" because you import numpy as np.
>
> Jitse
>
>
> On Sunday, 18 December 2016 03:06:30 UTC+13, Ray Shapp wrote:
>>
>> I am unable to import numpy into Spyder probably because I installed 
>> anaconda on my D drive. In preferences, my global working directory is:
>>
>>
>>
>> * D:\Python Scripts*When I put *import numpy as np *as line 1 of my 
>> script in editor, I get 
>> *NameError: name 'numpy' is not defined*
>> In a search of my hard drive, I see many instances of numpy, but I'm 
>> unsure which one to copy and I'm unsure as to where I should paste it to 
>> make it available for import.
>>
>> Note, on this setup, *import math* works with no problem. I would paste 
>> numpy in the same location as the math library except that math appears in 
>> multiple locations.
>>
>> I looked at *Tools* > *PYTHONPATH manager* and I see that it is empty. 
>> Maybe this is key to the solution?
>>
>> My question: where should my libraries reside? What should I put into 
>> PYTHONPATH manager?
>>
>> I am using Spyder v2.3.9 on 64x Win10 Pro.
>>
>> Thank you,
>>
>> RS
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"spyder" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/spyderlib.
For more options, visit https://groups.google.com/d/optout.

Reply via email to