Skip to content Skip to sidebar Skip to footer

No Module Named '_tkinter' On Mac Using Python 3

I'm trying to bundle my script into a .app using Tkinter as the GUI and the wrapper that does the bundling is Platypus. I'm getting this error when I go to run the app. Traceback

Solution 1:

Several problems: There is no file at /usr/bin/python3. Either use /usr/local/bin/python3 or /usr/bin/env with python3 as args. Or whatever your particular python environment needs.

For some reason, python is looking for the library inside Xcode, which is unusual. I have python3 installed and there's no python in

/Applications/Xcode.app/Contents/Developer/Library/Frameworks/

On my installation, the valid filepath is:

/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/tkinter/__init__.py

(i.e. in /Library, not inside Xcode.) As the script works in Terminal, it's likely that Platypus's config is wrong somehow.

As a quick hack, I suppose you could symlink Python.framework from /Library/Frameworks to the Frameworks folder inside Xcode.

As stated in the comments, you don't need to include the first import line. Currently, you're importing all of tkinter, and then importing just the filedialog. The whole point of from is to avoid importing the entire library.

Post a Comment for "No Module Named '_tkinter' On Mac Using Python 3"