I created an .exe
file with pyinstaller on Windows but when I try to open it on another Windows computer I have a traceback.
To create the .exe, I installed Python 3.7.
Then I pip installed pyinstaller and run it with --onefile
:
PS> py -3.7 -m pip install pyinstaller
PS> pyinstaller --onefile hello_world.py
I expect that pyinstaller --onefile
- embeded in the exe file everything including the Python.
- On the traceback I see that the python interpreter is the
c:\users\helen\appdata\local\programs\python\python37
this is the Python I used to create the.exe
. This Python is not suppose to exist in the target Windowe I execute the.exe
My goal is to make this .exe work on any computer.
Am I missing something ? Are there other arguments for pyinstaller to prevent those kinds of errors ?
important note: this is not a question relate to including pandas in pyinstaller PyInstaller and Pandas
hello_world.py
My hello_world.py is just a simple script using Tkinter to print hello world.
import tkinter as tk
import pandas as pd
class Application(tk.Frame):
def __init__(self, master=None):
super().__init__(master)
self.master = master
self.master.geometry("250x50")
self.master.title("POC")
self.pack()
self.create_widgets()
def create_widgets(self):
self.hi_there = tk.Label(self)
self.hi_there["text"] = "Hello World"
self.hi_there.pack(fill='x', side="top")
self.quit = tk.Button(self, text="QUIT", fg="red",
command=self.master.destroy)
self.quit.pack(side="bottom")
root = tk.Tk()
app = Application(master=root)
app.mainloop()
traceback
[7728] Failed to execute script hello_world
Traceback (most recent call last):
File "hello_world.py", line 2, in <module>
File "c:\users\helen\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 493, in exec_module
File "pandas\__init__.py", line 55, in <module>
File "c:\users\helen\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 493, in exec_module
File "pandas\core\api.py", line 29, in <module>
File "c:\users\helen\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 493, in exec_module
File "pandas\core\groupby\__init__.py", line 1, in <module>
File "c:\users\helen\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 493, in exec_module
File "pandas\core\groupby\generic.py", line 60, in <module>
File "c:\users\helen\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 493, in exec_module
File "pandas\core\frame.py", line 124, in <module>
File "c:\users\helen\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 493, in exec_module
File "pandas\core\series.py", line 4572, in <module>
File "pandas\core\generic.py", line 10349, in _add_series_or_dataframe_operations
File "c:\users\helen\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 493, in exec_module
File "pandas\core\window\__init__.py", line 1, in <module>
File "c:\users\helen\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 493, in exec_module
File "pandas\core\window\ewm.py", line 5, in <module>
ImportError: DLL load failed: Le module spécifié est introuvable.