Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ModuleNotFoundError: No module named '_tkinter' on python 3.8.0 mac OS 10.15.3

Tags:

python

tkinter

Using Python 3.8.0 on Mac OS 10.15.3 (Catalina) with pyenv.

When I try to run a file, it returns:

ModuleNotFoundError: No module named '_tkinter'

I've tried brew install tcl-tk. I'm a little worried that because I'm running python on top of pyenv, any third party tkinter module doesn't get run properly.

Running brew doctor returned:

Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew-provided
script of the same name. We found the following "config" scripts:
  `/Users/jm/.pyenv/shims/python3.7-config
  /Users/jm/.pyenv/shims/python3.7m-config
  /Users/jm/.pyenv/shims/python-config
  /Users/jm/.pyenv/shims/python3-config
  /Users/jm/.pyenv/shims/python3.8-config`
like image 722
doctopus Avatar asked Feb 10 '20 04:02

doctopus


People also ask

Does Python Tkinter work on Mac?

Install Tkinter on macOSTo install Python and Tkinter on macOS I recommend you use Homebrew. Homebrew is a package manager for command-line software on macOS. Homebrew has both Python 3 and Tkinter available in their repositories. This is also available to copy and paste from the Homebrew homepage.

How do I enable Tkinter in Python?

To install Tkinter, we need Python pre-installed. Tkinter actually comes along when we install Python. While installing Python, we need to check the td/tk and IDLE checkbox. This will install the tkinter and we need not install it separately.

How do I manually install Tkinter?

The simplest method to install Tkinter in a Windows environment is to download and install ActivePython 3.8 from here. Alternatively, you can create and activate a Conda environment with Python 3.7 or greater that is integrated with the latest version of Tkinter.


1 Answers

After trying a bunch of things, this is how it finally worked:

$ brew install python-tk
like image 145
subtleseeker Avatar answered Oct 09 '22 18:10

subtleseeker