Python Forum

Full Version: Installing/configuring Tkinter on Linux Mint 18?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm having trouble getting TKinter working.

Python 3.6.3 (default, Dec 13 2017, 17:56:50) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tkinter
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.6/tkinter/__init__.py", line 36, in <module>
    import _tkinter # If this fails your Python may not be configured for Tk
ModuleNotFoundError: No module named '_tkinter'
>>> 
I installed python3-tk and its dependencies.

Quote: $ cat /etc/lsb-release
DISTRIB_ID=LinuxMint
DISTRIB_RELEASE=18.2
DISTRIB_CODENAME=sonya
DISTRIB_DESCRIPTION="Linux Mint 18.2 Sonya"

Any thoughts?

Thanks
On archlinux had to install tcl.
Already have it...

Quote:$ sudo apt-get install tcl
Reading package lists... Done
Building dependency tree
Reading state information... Done
tcl is already the newest version (8.6.0+9).

I don't see any Python related TCL packages either...
Quote:$ apt-cache search tcl | grep python3
python3-fastcluster - Fast hierarchical clustering routines for Python 3
python3-heatclient - client library and CLI for OpenStack Heat - Python 3.x
python3-pyds9 - Communication with the ds9 image display program (Python-3)
python3-qwt - Pure Python implementation of Qwt - Python 3
python3-rtslib-fb - object API for managing the Linux LIO kernel target - Python 3.x
python3-swiftclient - Client library for Openstack Swift API - Python 3.x
python3-tksnack - Sound extension to Tcl/Tk and Python/Tkinter - Python 3.x library
I had to install tk. tcl was already install on my archlinux but not tk. Had to remember it.
Problem solved.

I installed Python 3.6 from source. When I built it, I didn't have Tcl\Tk dev packages installed so the Python build process skipped tkinter. If I noticed at the time (and I doubt that I noticed), I probably thought, "well, I don't use that anyway".

So I installed the appropriate dev package (tk-dev) and rebuilt python.