Create Windows executables on Linux using PyInstaller under Wine/Docker.
Based off of docker-pyinstaller, but now using Python 3.12 and the latest version of PyInstaller.
- Install Docker, Python, and PyInstaller.
- Clone the repo:
git clone https://github.com/iiPythonx/pyinstaller-windows
cd pyinstaller-windows
- Build the Docker container (one time process, per update):
./setup_container.sh
**Building the container takes around 2 minutes and 20 seconds on modern hardware.
For normal usage, the only file you need inside of your project is build.py
.
After you've done some programming and want to build your exe, just run:
./build.py <path to python file>
For example, in a typical src/
based project, you might run:
./build.py src/main.py
Additionally, you can edit the PyInstaller command options as well as the ability to add an icon to your executable, just by editing build.py
and rebuilding:
PYINSTALLER_OPTS = "--onefile"
PYINSTALLER_ICON = ""