-3

I had to uninstall and reinstall python for other reasons. Right now I downloaded python 3.8.2 through pyenv but running:

import tkinter

The error I get is:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/cagava/.pyenv/versions/3.8.2/lib/python3.8/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'

why is that so? Am I missing some modules in python installation?

Note that I am working on a Mac

I've tried the solution proposed on the issue (Python not configured for Tk) and others suggesting the same method but it didn't solve my problem

CG_python
  • 31
  • 2

1 Answers1

1

Struggling with this myself. For all the talk about the "annual ritual" to include tkinter with Python, it sure isn't well integrated, especially when using pyenv.

I'm about to take the plunge one site suggested: removing pyenv completely, then installing tcl-tk, then compiling a number of post-tcl-tk dependencies that come up after the tcl-tk install, then reinstalling pyenv (which should, supposedly, then add tkinter support - even though tkinter was installed on the default system python of 2.7.16, then reinstalling the versions of Python I've already installed (3.7 and 3.8 and which seem to work for everything but tkinter). Like I said - not well integrated. Were it not for the many comments about how well tkinter has been expanded and maintained I'd be tempted to (and actually, was tempted to) try something else.

Linux Ubuntu and PopOS (Ubuntu derivative) both display the same problem, on two different machines. I'll give the above a try and report back on the fireworks.

JD53
  • 11
  • 1