- Put latest copy of pyinstaller under the appropriate python folder e.g. Python26
- Run Configure.py e.g.
- Make a dev folder and put main script in there and a copy of the most recent spec file made for any other project. Use as a starting point.
- Make a bat file to produce the executable using the spec file to configure the end result e.g.
"C:\Python26\python.exe" "C:\Python26\pyinstaller-1.5\Build.py" "myproj.spec"
Include the pause so any errors can be spotted and fixed
- Make another batch script which runs the executable and has the pause command at the end so you can spot any errors and fix them (so screen doesn’t flash on and off without giving you a chance to read the error messages if any). NB no python.exe involved – just the exe you made e.g.
- Once testing is complete, remake the exe with live spec settings i.e. set console to False and debug to False.
- Distribute 🙂
Mistakes to avoid:
- Testing the exe with a batch file is good. Having the batch file try to run the exe with python, not so good (in fact, it is dumb 😉 ). Just run the exe on its own. Otherwise spurious error about encoding problem with line 1 of the exe. See Why this SyntaxError
- If making a script which execs everything else it needs (reason: to keep things flexible), the main script e.g. “exec_script2exec.py” MUST import anything needed by scripts it is likely to call otherwise they will not appear in the exe. Pyinstaller can’t read minds or predict the future 😉 . So import wx and import win32com.client are probably required for my MS Access project. Otherwise will get an error about no module called wx etc.