Import numpy using python 2.6

This might be a simple question, but I'm stuck: I want to use numpy with Python 2.6. I added the path where the numpy folder is located:

C: \ Python26 \ Lib \ site packages \

as well as the path to the numpy folder itself

C: \ Python26 \ Lib \ Site Packages \ NumPy

However, this error message appears

x=np.array([[7,8,5][3,5,7]],np.int32)


   Traceback (most recent call last):
      File "<pyshell#12>", line 1, in <module>
        x=np.array([[7,8,5][3,5,7]],np.int32)
    NameError: name 'np' is not defined

could you help me?

+5
source share
1 answer

You do not need to add these things to the path. Python knows where to look for installed modules if you have C: \ Python26 in the way.

Sven Marnach asked if you did it like this:

import numpy as np
x=np.array([[7,8,5],[3,5,7]],np.int32)

Edit: I just noticed that you also left a comma in the array declaration ... fixed it in the above

+14
source

All Articles