skip to Main Content

Whenever I try :

import numpy as np

I get this error in my VS Code terminal :

   import numpy as np
ModuleNotFoundError: No module named 'numpy'

I already have numpy installed in my device…

Then thinking that the numpy installed must be in the wrong location I ran the command pip install numpy in the VS Code terminal, it got successfully installed but still the same error.
I expected I would be able to use it but that did not work as well.

2

Answers


  1. Please check where you have installed your numpy library , if you are using python 3 then execute your code using below command

    python3 <filename>.py
    
    Login or Signup to reply.
  2. This problem is usually caused by an incorrect Python interpreter.

    You can use shortcuts Ctrl+Shift+P and type Python: Select Intepreter to choose the interpreter where you installed the numpy package.

    If you are just trying to debug quickly or just want the files to run, you can use command pip install numpy to reinstall without changing the interpreter in the current terminal.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search