我正在使用Debian Stable Linux,并从其存储库中安装了Nuitka应用程序:
$ nuitka --version
0.5.25
我正在尝试使用以下来自Building GUIs with Tkinter
的简单tkinter gui应用程序创建一个可执行文件import tkinter
mainWindow = tkinter.Tk()
mainWindow.title("Demo App")
# mainWindow.geometry("640x480+200+200")
entry1 = tkinter.Entry(mainWindow,width=10)
entry2 = tkinter.Entry(mainWindow,width=10)
entry1.pack()
entry2.pack()
label = tkinter.Label(mainWindow,text="Click on add to add numbers")
label.pack()
def add_values():
result = int(entry1.get()) + int(entry2.get())
label['text'] = result
button = tkinter.Button(mainWindow,text="Add",command=add_values)
button.pack()
mainWindow.mainloop()
但是,它给出了以下错误:
$ nuitka-run addergui.py
Traceback (most recent call last):
File "...addergui.py", line 2, in <module>
import tkinter
ImportError: No module named tkinter
如果我将import语句更改为:
import Tkinter as tkinter
然后我也得到错误:
$ nuitka-run addergui.py
Traceback (most recent call last):
File ".../addergui.py", line 2, in <module>
import Tkinter as tkinter
File "/lib/python2.7/lib-tk/Tkinter.py", line 39, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
ImportError: /lib/python2.7/lib-dynload/_tkinter.so: wrong ELF class: ELFCLASS64
当分别与python3和python2一起使用时,应用程序可以运行两个导入命令。我查了Nuitka user manual但无法解决这个问题。
问题出在哪里?如何解决?谢谢你的帮助。