Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ImportError: No module named 'tkinter' after pyInstaller

I want to do an executable, but ervery time I run the .exe it writes ImportError: No module named 'tkinter', and all I read on Stackowerflow do not help me !

My python program is simple (ODE solver) and requests only :

from math import*
from pylab import*
import numpy as np

import matplotlib
import numpy as np
import matplotlib.pyplot as plt

I paste a copy of my prog.py into the C:\Python\Scripts folder where pyInstaller is. I compute the command line pyinstaller -F eulersolver.py, this creates a prog.exe in the dist folder. When I run this code I have

ImportError: No module named 'tkinter'
Failed to execute script prog

But my program do not use this module... do you have any proposition or help for me ?

OS : Windows64

Python : 3.5 for Win64

Note : I already unistall/install python 3 times today (after reading documentation on this webside and abroad).

Note 2 : I use Python only for scientific issues. I am no computer scientist, so be kind to me when explaining computer stuff :S

like image 677
John Avatar asked Mar 11 '23 09:03

John


2 Answers

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

like image 147
John Avatar answered Mar 20 '23 21:03

John


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

like image 21
Arduino_Sentinel Avatar answered Mar 20 '23 21:03

Arduino_Sentinel