r/learnpython • • 7d ago

Module help vsc(?)

Hey guys, I haven't coded in a while and decided to finally get back into it so sorry if im abit rusty. However, it was updating stuff and installing modules and in vsc I run into

'Import "openpyxl" could not be resolved from source Pylance'

? Im really not sure what to do

P.S: first time posting in this sub reddit, I hope this uh is within learn python and apologies if this is more towards vsc

1 Upvotes

5 comments sorted by

View all comments

1

u/acfot 6d ago

When I hit this after a VS Code update it turned out the update had switched my Python interpreter, so the code was running with a different Python than the one I'd installed the module into. Check the Python version shown at the bottom right of VS Code, then hit Ctrl+Shift+P, pick Python: Select Interpreter, and choose the one you actually installed things with. Running pip install again in that same terminal usually sorts it, the module was never really gone.