skip to Main Content

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


  1. 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.

    Login or Signup to reply.
    • Ctrl+Shift+P –> Python: Select Interpreter –> Choose the correct interpreter

      enter image description here

    • The current interpreter version will be displayed in the lower right corner of the vscode interface.

      enter image description here

    • Make sure to execute the script with the Python extension

      enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search