Create an .exe file from a python script
The following packages are needed:
- The Qt Software Development Kit, Qt SDK. Available from http://qt.nokia.com/downloads. When installing, select the custom installation and make sure you install the Desktop library version that matches with the Pyside bindings you use. Also, the MinGW environment should be installed.
- Python interpreter for Windows, Python 2.7.3 Windows Installer. Available from http://www.python.org/download.
- Pyside Binaries for Windows. Available from http://qt-project.org/wiki/PySide_Binaries_Windows. Make sure you download and install the version that matches your QT library version and your Python interpreter version.
- setuptools. Available from http://pypi.python.org/pypi/setuptools.
- Python for Windows extensions (PyWin32) only if you are using python 2.6 or above. Available from: http://sourceforge.net/projects/pywin32.
All five tools should be installed following the order in which the are presented. These tools can be easily installed as they are bundled as executables.
Finally, you will also need the TASTE GUI python sources to build the executable.
Next, extract the content of the zip file and open a command window in that directory.
Type the following to configure the PyInstaller setup:
C:\PyInstaller> python Configure.py
This will only have to be run once unless you change your python version.
Next, create a spec file for the project:
C:\PyInstaller> python Makespec.py -w --icon=<iconfile.ico> tasteGUI.py
This command will create a spec file .\tasteGUI\tasteGUI.spec that will produce a single directory deployment (use the -F to deploy a single file) that uses the Windows subsystem executable (-w) and adds the iconfile.ico icon.
Finally, build the project to a stand-alone executable:
C:\PyInstaller> python Build.py .\tasteGUI\tasteGUI.spec
The final generated file will be place in the dist directory under .\tasteGUI.
Note: If you want to generate the executable and its associated *.dlls with the minimum size download UPX from http://upx.sourceforge.net/, install it and make sure you add it to your path before you run configure the PyInstaller setup. Then, add the -X option when generating the spec file:
C:\PyInstaller> python Makespec.py -X -w --icon=<iconfile.ico> tasteGUI.py