I'm building a Python application and don't want to force my clients to install Python and modules. I also want to make my application closed-source.
So, is there a way to compile Python scripts to standalone executables?
|
I'm building a Python application and don't want to force my clients to install Python and modules. I also want to make my application closed-source. So, is there a way to compile Python scripts to standalone executables? |
|||||||||||||||||||||
|
|
You can use py2exe as already answered and use cython to convert your key |
|||||||||||||||||||||
|
|
I have had some success with pyinstaller. Works on linux as well as windows. |
|||||||||||||||||||||
|
|
You might wish to investigate Nuitka. It takes python source code and converts it in to C++ API calls. Then it compiles into an executable binary (ELF on Linux). It has been around for a few years now and supports a wide range of Python versions. You will probably also get a performance improvement if you use it. Recommended. |
|||||||||
|
|
And a third option is |
|||
|
|
|
you may like py2exe. you'll also find in there infos for doing it on linux |
|||||
|
|
Use py2exe.... use below set up files:
|
|||||||||||||||||
|
|
I would like to compile some useful information about creating standalone files on windows using Python 2.7. I have used py2exe and it works, but I had some problems.
This last reason made me try PyInstaller http://www.pyinstaller.org/ . In my opinion, it is much better because:
I suggest creating a .bat file with the following lines for example (pyinstaller.exe must be in Windows Path):
So, I think that, at least for python 2.7, a better and simpler option is PyInstaller. |
|||||
|
|
I also recommend pyinstaller
for better backward compatibility such as python 2.3 - 2.7.
|
|||
|
|
|
Yes, it is possible to compile Python scripts into standalone executable. PyInstaller can be used to convert Python programs into stand-alone executables, under Windows, Linux, Mac OS X, FreeBSD, Solaris and AIX. It is one of the recommended converters. py2exe converts Python scripts into only executable in Windows platform. Cython is a static compiler for both the Python programming language and the extended Cython programming language. |
|||||
|
|
For Python 3.2 scripts the only choice is Cxfreeze. Build it from sources otherwise it won't work. For python 2.x I suggest pyinstaller as it can package a python program in a single executable, unlike CxFreeze which outputs also libraries. |
||||
|
|
|
py2exe will make the exe file you want but you need to have the same version of MSVCR90.dll on the machine you're going to use your new exe. See http://www.py2exe.org/index.cgi/Tutorial for more info. |
|||
|
|
|
You can find the list of distribution utilities listed @ https://wiki.python.org/moin/DistributionUtilities. I use bbfreeze and it has been working very well (yet to have python 3 support though). |
|||||||||||||
|
|
Not exactly a packaging of the python code, but there is now also grumpy from google, which transpiles the code to Go. It doesn't support the python C api, so it may not work for all projects. |
|||
|
|
|
Use Cython to convert to c, compile and link with gcc. Another could be, make the core functions in c (the ones you want to make hard to reverse), compile them and use python boost to import the compiled code ( plus you get a much faster code execution). then use any tool mentioned to distribute. |
||||
|
|
|
I'm told that PyRun, https://www.egenix.com/products/python/PyRun/, is also an option. |
|||||
|
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?