Reputation: 1156
I have installed Anaconda for Windows. It's on my work PC, so I chose the option "Just for Me" as I don't have admin rights.
Anaconda is installed on the following directory:
c:\Users\huf069\AppData\Local\Continuum\Anaconda
The Windows installer has added this directory (+ the Anaconda\Scripts directory) to the System path.
I can launch Python but trying to run
x = randn(100,100)
gives me a Name Error: name 'randn' is not defined
,
whereas, as I understood, this command should work when using Anaconda, as the numpy package is included.
it works fine if I do:
import numpy
numpy.random.randn(100,100)
Anyone understand what could be happening ?
Upvotes: 0
Views: 5861
Reputation: 3981
I can launch Python, but trying to run
x = randn(100,100)
gives me aName Error: name 'randn' is not defined
, whereas, as I understood, this command should work when using Anaconda, as thenumpy
package is included
The Anaconda distribution comes with the numpy
package included, but still you'll need to import the package. If you want to use the randn()
function without having to call the complete name, you can import it to your local namespace:
from numpy.random import randn
x = randn(100,100)
Otherwise, the call numpy.random.randn
is your way to go.
You might want tot take a look at the Modules section of the Python Tutorial.
Upvotes: 7