Python Forum

Full Version: Problem with Pyinstaller. No module named '_tkinter'
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello, I'm trying to obtain a single exectuable file to run on my MAC M1.

I use Pyinstaller in this way:

pyinstaller --onefile myproject.py

but when I run the file generate, that is located in dist folder it give me this error:

Last login: Mon May 15 16:41:51 on ttys011
/Users/antonio/Desktop/PYPROJECT/dist/spegnimento ; exit;
antonio@MacBook-Air-di-Antonio ~ % /Users/antonio/Desktop/PYPROJECT/dist/spegnimento ; exit;
Traceback (most recent call last):
File "spegnimento.py", line 4, in <module>
File "PyInstaller/loader/pyimod02_importers.py", line 352, in exec_module
File "tkinter/__init__.py", line 38, in <module>
ModuleNotFoundError: No module named '_tkinter'
[16333] Failed to execute script 'spegnimento' due to unhandled exception!


I used also a virtual env but the result is the same.
In the pip list the tk (that is tkinter) is present.

Could someone help me to solve this problem? Thanks in advance