Package your python application (for Windows and Linux) with just a right-click!

Recently I’ve written a brief post about the packaging of a python script for Linux and Windows on a Linux machine, using PyInstaller and Wine.

Today i want to propose the same process, performed on Windows.


Prerequisites

  • An updated Windows 10, with Linux Subsystem enabled and configured with Ubuntu (please refer to this link:  https://docs.microsoft.com/en-us/windows/wsl/install-win10 )

How

  • Install Python (with Pip) on Windows (get latest build from https://www.python.org/downloads/ )
  • Install Python and Pip on Ubuntu (installing pip solve all python dependencies): apt install python-pip
  • Install PyInstallter on Windows and Linux: pip install pyinstaller

Once the enviroment is correctly configured, you can create the contextual menu:

  • Download this template and save it as .reg file:

https://gist.github.com/andreafortuna/a1fbc701cb739b05131cbf2157ea7e46

  • Modify the file with the correct paths (on lines 15 and 22).
  • Finally, import the .reg file and test the configuration.

Here a brief demo:


References

  • https://docs.microsoft.com/en-us/windows/wsl/install-win10
  • http://www.pyinstaller.org/
  • https://www.python.org/downloads/