Suppose I have a working application written in Python on some Linux distribution, I would like to know if it is possible to produce an executable for Windows within Linux, with pyinstaller or another similar program, and how to create some kind of Windows installer for that program that will place the program and some data in a relevant directory. Any advice is welcomed!
I’ve successfully used PyInstaller running under Wine to produce an executable which runs on Windows. Set up your Wine environment on Linux, putting a copy of PyInstaller in an appropriate location. eg
Also install Python for Windows in your Wine environment. You have to use the
msiexec option run the Python installer.
wine msiexec /i python-2.6.6.msi
You might also need to install other dependencies such as
Then, simply run PyInstaller on you spec file:
wine c:/Python26/Python.exe c:/pyinstaller-2.0/pyinstaller.py <spec_file>
This takes care of creating an executable which will run under windows. Packaging this exe as part of an installer is an additional task for which you could use NSIS as suggested in other answers. I’m not sure if NSIS will successfully run under Wine on Linux, so this only answers half of your question.
If you need to make an installer , try these:
As suggested you can use wine http://www.winehq.org/ to run on Linux.