VsCode notebook can't see pandas module

Question:

In VsCode I have activated .venv environment in which I can see pandas module confirmed with pip show pandas command and I still see error: ModuleNotFoundError: No module named 'pandas'

(.venv) C:PythonWstestVsCodeNotebook>python –version
Python 3.10.8

How I can resolve this?

enter image description here

enter image description here

enter image description here

John Gordon points out that VsCode uses the wrong path to the python interpretation (.venv environment was created from VsCode palette and activated from command line). How I can fix it in VsCode?

PS. I put import pandas as pd; in a standalone python file and it works without any problem.
enter image description here

Asked By: AlexeiP

||

Answers:

When you use jupyter notebook, you need to choose kernel, click the following button in picture:

enter image description here

You can also read document for more details.

Answered By: MingJie-MSFT