by BiteCode_dev · 5y ago · 0 comments
>>> import tkinter as tk
>>> tk.Tcl().eval('puts {hello, world}')
hello, world
'' >>> import tkinter
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.9/tkinter/__init__.py", line 37, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
ImportError: libtk8.6.so: cannot open shared object file: No such file or directoryIndeed, most linux distro packaging teams decided to split tk in a separate package that is not installed by default. Same for pip and setuptools. Of course, this made getting a congruent python experience extra hard, on a platform with already plenty of gotchas for python setup, but hey, they saved a few Mo.
$ python3
Python 3.6.9 (default, Jan 26 2021, 15:33:00)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more
information.
>>> import tkinter
>>> tkinter.Tcl().eval('puts {hello, world}')
hello, world
''
>>>
Ubuntu 18.04; but it's not on a machine running 20.04