'python file to excutable file at any operating system

Now I created a python app using tkinter which it should be used in pc, but I am using windows, so I executed the .py file to .exe.

My problem now is my program that I created need to be shared to others so, some users are not using windows some are using Linux, so they need .elf file and some others are using mac, so they need .dmg file to open the program.

When I searched for creating a .elf file or .dmg like this website: https://dev.to/petercour/python-to-executable-35pj

They are saying that if you are using Linux you will create a .elf file after by using pyinstaller as usual, and I am using windows.

But, I am sure that there is a way to do this instead of using another operating system to convert this file.

Could anyone help please to release this app. (that's my first python app, and it's very important to me, and it's my first time at this level)



Solution 1:[1]

You can't create a Linux or Mac executable using pyinstaller on Windows. You need to run Linux to create an .elf file.

However, you can run a virtual machine inside Windows that runs Linux. Then install Python and pyinstaller in that virtual machine and you can create an .elf file. Same story for Mac.

Solution 2:[2]

You can use cx_Freeze(Requires Visual Studio C++ compiler. ) or Pyinstaller.

You can install Pyinstaller with pip install pyinstaller and you can convert .py to executable file with ./pyinstaller yourfile.py in Python310/Scripts directory. You can select icon with --icon option and you can make it to one file with --onefile option. But, you can't create Python file to .elf or .dmg in Windows.

cx_Freeze converts Python to executable file too. But, it supports .msi file too. You can install it with pip install cx_Freeze and make setup.py file;

from cx_Freeze import setup, Executable

buildOptions = dict(packages=['moduleInYourFlie1', 'modulesInYoueFile2'])

exe=[Executable('yourPythonProgramname.py', base='Win32GUI', icon='yourIconFllePath/youriconfilename.ico', shortcutName='Programname', shortcutDir='DesktopFolder')] setup( name='Programname', version='0.0.1', author='Yourname', description = 'Yourprogramdescription', options = dict(build_exe = buildOptions), executables=exe )

And you can make python setup.py build in command line. If you want msi file, you can type bdist_msi instead of build command.

Pyinstaller and cx_Freeze both doesn't support .dmg and .elf in Windows. Instead, use VMware or VirtualBox to make .dmg and .elf file.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ignace Vau
Solution 2