1

From my understanding, tkinter is built in to python. However, when i tried to run the following code

from turtle import *

I get this error

Traceback (most recent call last): File "myturtle.py", line 1, in from turtle import * File "/usr/lib/python3.6/turtle.py", line 107, in import tkinter as TK ModuleNotFoundError: No module named 'tkinter'

I solved this by doing

sudo apt install python3-tk

But why did I have to do this? I thought tkinter would come with my python3 installation. I installed it with the apt command.

I'm also new to package management and trying to learn. I am using Ubuntu which I think uses the Debian package manager. Does it have to do with that?

frownyface
  • 153
  • 1
  • 8
  • This might help https://stackoverflow.com/questions/6084416/tkinter-module-not-found-on-ubuntu – Joel May 28 '19 at 05:12
  • 1
    @JoelD'Souza The link that you provided does not explain why Tkinter is not included. In fact, despite being a library module and the Wikipedia claim that it comes with Python on all major platforms, the number of questions like "How do I install tkinter?" suggests that very often it is not a part of the default installation. The question "why" remains open. – DYZ May 28 '19 at 05:15

0 Answers0