Compile Python Virtual Environment
Solution 1:
Yes you can package your python programs and it's dependencies with
There are other python modules that do the same, personally i prefer cx_Freeze
because it's cross platform and was the only one that worked out of the box for me.
By default cx_Freeze
automatically discovers modules and adds them to the exe to be generated. but sometimes this doesn't work and you might have to add them by yourself
To create a simple executable from a file. you can just use the bundled cxfreeze
script
cxfreeze hello.py--target-dir dist
but more for more complex applications that have different files you'll have to create a distutils setup script.
Note that cx_freeze
doesn't compile your code like a traditional compiler. it simply zips your python files and all it's dependencies ( as byte code) together, and includes the python interpreter to make your program run. So your code can be disassembled. (if anyone wants to) and you'll also notice that the size of your program would be larger than it was initially (Because of the extra files included)
Solution 2:
I ended up using PyInstaller as this worked out of the box for me.
Post a Comment for "Compile Python Virtual Environment"