Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create single python executable module

Guys, I have much python code in modules which are resides in several python packages and now I need to create single python executable module or file which will include all these files, so it will be working on windows and on linux servers. What are possible solutions and how this can be done?

like image 635
yart Avatar asked Jan 04 '10 12:01

yart


People also ask

Can you create a Python executable?

Underneath the GUI is PyInstaller, a terminal based application to create Python executables for Windows, Mac and Linux. Veteran Pythonistas will be familiar with how PyInstaller works, but with auto-py-to-exe any user can easily create a single Python executable for their system.

Which is better PyInstaller or py2exe?

In PyInstaller it is easy to create one exe, By default both create a bunch of exes & dlls. In py2exe its easier to embed manifest file in exe, useful for run as administrator mode in windows vista and beyond. Pyinstaller is modular and has a feature of hooks to include files in the build that you like.


1 Answers

For windows use py2exe , for linux use pyinstaller and for Mac use py2app

Using these tools you can have a setup.py which based on os will build the final binary.

I have tried all three and they work well, or you can use cx_freeze they claim to be cross-platform

like image 126
Anurag Uniyal Avatar answered Nov 07 '22 01:11

Anurag Uniyal