ImportError: No module named 'tkinter' after pyInstaller

百般思念 提交于 2019-12-01 10:50:50

You should use hidden import
pyinstaller eulersolver.py --hidden-import=tkinter -y

FINALLY WORKED FOR pyinstaller -F --hidden-import=tkinter --hidden-import=tkinter.filedialog prog.py Thanks a lot !!!

The problem is that pyinstaller won't see second level imports. So if you import module A, pyinstaller sees this. But any additional module that is imported in A will not be seen.

There is no need to change anything in your python scripts. You can directly add the missing imports to the spec file (prog.spec in your case). Just change the following line:

hiddenimports=[],

to

hiddenimports=["tkinter"],

After that run pyinstaller prog.spec to create the prog.exe.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!