I was working on a Python project when I had to restart my vscode. After relaunching it for some reason none of my modules won’t load and I keep getting the error:
Exception has occurred: ModuleNotFoundError
No module named '_tkinter'
File "...", line 1, in <module>
import tkinter as tk
ModuleNotFoundError: No module named '_tkinter'
And all of my other imported modules appear with the orange error underscore.
I made sure to check that the modules were installed and it kept telling me that they are:
Requirement already satisfied: pydub in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages
And I restarted vscode and even reinstalled it but nothing worked.
2
Answers
If you’re sure the modules are already installed, maybe check whether you’re using the right interpreter. Around the top right, there should be a button saying something like "(Python 3.x.x)", click on that and change the interpreter there and see if it works.
Ctrl+Shift+P –> Python: Select Interpreter –> Choose the correct interpreter
The current interpreter version will be displayed in the lower right corner of the vscode interface.
Make sure to execute the script with the Python extension