1

With the help from python Spyder not importing numpy I am trying to run this code from Spyder but it is not working though I have installed Numpy via the command "conda install numpy"

import numpy as np


a = np.array([[1,0,0],
          [0,1,0],
          [0,0,1]])
print(a)

 

The output in the console in "No module named numpy" Can anyone please help me?

Thanks in advance.

Aritra
  • 11
  • 1
  • try "pip install numpy" – ph140 Sep 15 '21 at 15:36
  • The problem is that whatever interpreter your Spyder IDE is using is not the one where you installed numpy (you have multiple installations) – juanpa.arrivillaga Sep 15 '21 at 15:38
  • IIRC somewhere in Spyder's settings there's an option to change/view the currently used python interpreter. Try to set it to a python executable for which you did install numpy, or copy the path that is currently there and run `/path/to/python/executable/python -m pip install numpy`. – jrbergen Sep 15 '21 at 15:56
  • @juanpa.arrivillaga Yes you are correct. When I am entering Syper via terminal then this "numpy" is working properly. But when I am entering Spyder via my installed application there "numphy" is not working. Could you please advice me that how can I fix this problem? – Aritra Sep 15 '21 at 15:58
  • I don't use Spyder, but IDEs will generally allow you to set the interpreter, you're going to have to look that up or figure it out – juanpa.arrivillaga Sep 15 '21 at 15:59
  • which is IDE is better to use? – Aritra Sep 15 '21 at 16:19
  • Just in case, to change the interpreter or use packages with the installer version of Spyder maybe this video could be useful: https://www.youtube.com/watch?v=i7Njb3xO4Fw – Daniel Althviz Sep 15 '21 at 16:51

0 Answers0