Skip to content

Instantly share code, notes, and snippets.

@jrialland
Created September 22, 2015 16:25
Show Gist options
  • Save jrialland/4cdb150f7ef64f44743d to your computer and use it in GitHub Desktop.
Save jrialland/4cdb150f7ef64f44743d to your computer and use it in GitHub Desktop.
Recipe that allows to cross-compile a window(32bits) .exe out of a python script under linux.
#recipe from https://milkator.wordpress.com/2014/07/19/windows-executable-from-python-developing-in-ubuntu/
# allows to cross-compile a window(32bits) .exe out of a python script under linux.
cat > test.py <<< EOF
print "hello world !"
EOF
apt-get install scons wine
git clone https://github.com/pyinstaller/pyinstaller
git clone https://github.com/htgoebel/virtual-wine.git
./virtual-wine/vwine-setup venv_wine
. venv_wine/bin/activate
#get windows installer (32bits)
wget https://www.python.org/ftp/python/2.7.8/python-2.7.8.msi
wine msiexec -i python-2.7.8.msi
#get pywin32 (32bits) --dependency for pyinstaller
wget http://vorboss.dl.sourceforge.net/project/pywin32/pywin32/Build%20219/pywin32-219.win32-py2.7.exe
wine pywin32-219.win32-py2.7.exe
#run pyinstaller
wine c:/Python27/python.exe pyinstaller/pyinstaller.py --onefile test.py
file dist/test.exe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment