Reputation: 11
I tried importing the Tkinter module in Visual Studio Code while writing code for UI development. I'm getting the following error:
ModuleNotFoundError: No module named 'Tkinter'
Do I have to do a pip install
for this module? Also, how do I do that in VSC?
Upvotes: 0
Views: 7933
Reputation: 1832
Which python version are you using? Tkinter should come with Python. You can allways try
python -m tkinter
That should open an exemplary window (reference). Further you could also just try to pip install tkinter
In python modules (packages) are managed with pip. Pip is indepent of your IDE (in your case visual studio) you can call it from the console. See here
pip --version
python -m ensurepip --default-pip
Edit
I have a guess what the problem is. Your python version is not correctly in your PATH variable. Check this link . While installing python you probably unticked the check box to add python to your path. Here is also a step by step to fix this
Upvotes: 1