sanchari
sanchari

Reputation: 1

import in python working on my Linux Terminal but raising ModuleNotFoundError on VS code

I am very beginner to Linux as I recently started using it. I installed different libraries like numpy, pandas etc. import numpy as np import pandas as pd It raises a ModuleNotFoundError in VS Code. But when I run the same code in Terminal, there's no issue. Note: I installed these libraries with pip3 install package OS: Ubuntu 22.04

I tried to uninstall the package and reinstall but still not working. I also tried to install by sudo apt-get install python3-pandas. Nothing works out.

Upvotes: 0

Views: 62

Answers (2)

MingJie-MSFT
MingJie-MSFT

Reputation: 9209

It seems that you have two or more interpreter of python.

You can use shortcuts "Ctrl+Shift+P" and type "Python: Select Interpreter" to choose the correct python interpreter in VsCode.

Upvotes: 0

casonadams
casonadams

Reputation: 1170

Without all the context, it sounds like you have a few different python environments.

In terminal check which python you are using which python In VSCode settings check Python: Default Interpreter Path

That might help you understand what is going on. Make sure that the VSCode python path is the same path that your terminal prints out.

Upvotes: 1

Related Questions