Search code examples
pythonnumpyvisual-studio-codeanaconda3

Unable to run NumPy on VS Code


I have installed Anaconda (with Python 3.9) and Python (3.11) separately. After installing VS Code, I have also created a separated Anaconda environment Env01 . Now, when I open a VS Code file, I have three available environments to choose from

a) base Python 3.11

b) base Conda 3.9

c) Env01

I've chosen Env01 as my interpreter using Ctrl+Shift+P since I understand Anaconda comes with NumPy, Pandas, SciPy and MatPlotlib.

However, when I try to run

import numpy as np

I still get an error that reads

ModuleNotFoundError: No module named 'numpy'

How do I resolve this?


Solution

  • How did you install the package?

    If you choose the Env01 environment which is an conda environment.

    You have to install package by using command conda install packageName after using "Ctrl+Shift+P" and typing "Python: Select Interpreter".

    Read document for more details.