I am trying to convert Python code (which uses Tkinter) to executable with Nuitka but it is giving following error:
$ nuitka --recurse-all srcfile.py --exe
Nuitka:WARNING:srcfile.py:3: Cannot find 'tkinter.ttk' as relative or absolute import.
The exe file is created and it runs but stops with error:
File "/home/abcd/srcfile.py", line 2, in <module>
import tkinter as tk
ImportError: No module named tkinter
I am working on Debian Stable Linux. Where is the problem and how can this be solved?
nuitka
is not a standalone tool but a Python module. As such, it belongs to a Python installation and uses the corresponding interpreter's facilities and library to scan the code and such.
E.g. if your copy happens to belong to a Python 2 installation, it will scan that Python 2's standard library, and Tkinter is named Tkinter
in Python 2.
So, you need to install nuitka
for the same Python environment as what your program is supposed to use.