Skip to content Skip to sidebar Skip to footer

Packages Not Working, Using Anaconda

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:\Us

Solution 1:

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

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 importrandnx= 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.

Post a Comment for "Packages Not Working, Using Anaconda"