Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can i use Docker for creating exe using pyinstaller

I am supposed to create an executable for windows, mac and linux. However, I don't have a windows machine for time being and also I don't have a mac at all. I do have a Linux machine but I don't want to change the partition or even create a dual boot with windows.

I have created an application using python and am making my executable using pyinstaller. If I make use of Docker (install images of windows and mac on linux), will I be able to create executable for windows and mac with all dependencies (like all .dll for windows and if any similar for mac)?

like image 217
arvindh Avatar asked Oct 21 '16 13:10

arvindh


People also ask

Can Docker run any application?

You can run any application in Docker as long as it can be installed and executed unattended, and the base operating system supports the app. Windows Server Core runs in Docker which means you can run pretty much any server or console application in Docker.

Does PyInstaller EXE require Python?

They do not need to have Python installed at all. The output of PyInstaller is specific to the active operating system and the active version of Python. This means that to prepare a distribution for: a different OS.

Where does PyInstaller create EXE?

Creating an executable using PyInstaller Creates a BUILD folder in the same folder as the script and writes some log files and working files in the BUILD folder. Creates a DIST folder in the same folder as the script, if it does not already exist.


1 Answers

Yes, you can.

If you install Wine inside the container, then you can install the Windows version of Python + pyinstaller and build an exe using that. You can even install binary dependencies if you install the standalone visual studio build packages.

A python 2.7 implementation of such a thing can be found at:

  • https://github.com/cdrx/docker-pyinstaller (newer, doesn't support binary packages, haven't used it)
  • https://github.com/scottbelden/docker-winpyinstaller (helped to develop this)
like image 86
Dustin Spicuzza Avatar answered Sep 30 '22 04:09

Dustin Spicuzza