This may be a simple question, but I am stuck: I want to use numpy with Python 2.6. I appended the path where the numpy folder is located:
C:\Python26\lib\site-packages\
and also the path for 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 with this?
The NumPy project has supported both Python 2 and Python 3 in parallel since 2010, and has found that supporting Python 2 is an increasing burden on our limited resources; thus, we plan to eventually drop Python 2 support as well.
Python import numpy is not working that means eithers the module is not installed or the module is corrupted. To fix the corrupted module, uninstall it first then reinstall it.
You shouldn't have to add those things to the path. Python knows where to look for installed modules as long as you have C:\Python26 in the path.
Sven Marnach was asking 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 you left out a comma in your array declaration also...fixed it in the above
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With