Windows Single Executable
Windows users are used to programs being a single .exe file that can be
doubleclicked to run. We can produce that kind of user experience, targetting
especially users that are less tech-savvy and e.g. have IE11 as their default
browser which can be problematic. An alternative may be us giving them a
download link to our “app” program, which is basically a bundled Chrome that
loads our web application URL on startup.
The following is one of the many ways to get there:
– Use nativefier to create a portable Chrome loading our web app. Ideally you should build on the target platform (Windows 7 or 10 in our case) Command may look like this:
$ nativefier --name=MyProject "https://myproject.com" --maximize --single-instance
- This gives us a folder with an executable and a whole bunch of other stuff like .dll files, not very convient yet.
- We can bundle this into a protable single executable for people to download and run.
- Of the many broken ways to do this on Windows I found this one to work. Assuming
package
is the directory created bynativefier
andmain.py
a script as below:- Download Python 2.7 (on 3.5, pyinstaller on Windows 10 has huge issues bundling builtin dll files)
- Create a main.py like below:
# main.py import sys, os if getattr(sys, 'frozen', False): bundle_dir = sys._MEIPASS else: bundle_dir = os.path.dirname(os.path.abspath(__file__)) exe = os.path.join(bundle_dir, "MyProject.exe") os.system(exe)
- Install pyinstaller and run it against the script:
$ pip install virtualenv $ virtualenv venv $ venv\Scripts\activate $ pip install pyinstaller $ pyinstaller main.py --onefile --add-data="package;."
- This will produce
dist/main.exe
which is our single runnable executable. pyinstaller can also be used to add an icon file--icon=app.ico

This works pretty well. The only problem I have is it launches a console window too. I tried using –windowed but it doesn’t seem to help. Did that happen to you, did you find a solution?
Hi, pyinstaller has a
--noconsole
flag that should work for you https://pyinstaller.readthedocs.io/en/stable/usage.html#windows-and-mac-os-x-specific-options