for ages now i have been trying to package my python applications up as a stand alone executable. i have been attempting to use py2exe
but it has never seemed to work.
lets say we have machine A and machine B, i build the program on machine A and try to run as an executable on machine B. on the first few attempts when trying to run on machine B it would say FATAL ERROR: Cannot load python library
but i thought that was down to the py2exe
process saying 1 missing module
full:
1 missing Modules
------------------
? readline imported from cmd, code, pdb
Building 'dist\workinghoursGUI.exe'.
Building shared code archive 'dist\library.zip'.
Copy c:\python34\python34.dll to dist
Copy C:\Python34\DLLs\select.pyd to dist\select.pyd
Copy C:\Python34\DLLs\_lzma.pyd to dist\_lzma.pyd
Copy C:\Python34\DLLs\_socket.pyd to dist\_socket.pyd
Copy C:\Python34\DLLs\unicodedata.pyd to dist\unicodedata.pyd
Copy C:\Python34\DLLs\_bz2.pyd to dist\_bz2.pyd
Copy C:\Python34\DLLs\pyexpat.pyd to dist\pyexpat.pyd
Copy C:\Python34\DLLs\_hashlib.pyd to dist\_hashlib.pyd
Copy C:\Python34\DLLs\_ssl.pyd to dist\_ssl.pyd
Copy C:\Python34\DLLs\_ctypes.pyd to dist\_ctypes.pyd
Copy C:\Python34\DLLs\_tkinter.pyd to dist\_tkinter.pyd
Copy DLL C:\Python34\MSVCR100.dll to dist\
Copy DLL C:\Python34\DLLs\tk86t.dll to dist\
Copy DLL C:\Python34\DLLs\tcl86t.dll to dist\
then i saw this question Py2Exe "Missing Modules" and found out i needed to install pyreadline
so i did, then the py2exe
process didnt return any missing modules like so:
Building 'dist\workinghoursGUI.exe'.
Building shared code archive 'dist\library.zip'.
Copy c:\python34\python34.dll to dist
Copy C:\Python34\lib\site-packages\win32\_win32sysloader.pyd to dist\_win32sysloader.pyd
Copy C:\Python34\DLLs\_ssl.pyd to dist\_ssl.pyd
Copy C:\Python34\DLLs\select.pyd to dist\select.pyd
Copy C:\Python34\DLLs\_socket.pyd to dist\_socket.pyd
Copy C:\Python34\DLLs\_bz2.pyd to dist\_bz2.pyd
Copy C:\Python34\DLLs\_lzma.pyd to dist\_lzma.pyd
Copy C:\Python34\DLLs\pyexpat.pyd to dist\pyexpat.pyd
Copy C:\Python34\DLLs\_tkinter.pyd to dist\_tkinter.pyd
Copy C:\Python34\DLLs\unicodedata.pyd to dist\unicodedata.pyd
Copy C:\Python34\lib\site-packages\win32\win32api.pyd to dist\win32api.pyd
Copy C:\Python34\DLLs\_hashlib.pyd to dist\_hashlib.pyd
Copy C:\Python34\lib\site-packages\win32\win32evtlog.pyd to dist\win32evtlog.pyd
Copy C:\Python34\DLLs\_ctypes.pyd to dist\_ctypes.pyd
Copy DLL C:\Python34\DLLs\tcl86t.dll to dist\
Copy DLL C:\Python34\MSVCR100.dll to dist\
Copy DLL C:\Python34\DLLs\tk86t.dll to dist\
Copy ExtensionDLL C:\Python34\pywintypes34.dll to dist\
but now on machine B when the .exe
is run a window with just the output port>
is shown while the application runs fine on machine A
this is my setup file:
from distutils.core import setup
import py2exe,sys,os
setup(console=['workinghoursGUI.py'])
and the imports in my program are all in the standard release of python which are:
from tkinter import *
from tkinter import ttk
import tkinter as tk
import tkinter.messagebox as tkm
import datetime,os,time
im probably doing something obviously wrong but i cant work out what, does anyone know how i can resolve this issue or am i just going to have to give up?
the dist
folder looks like this: