What is the best way to freeze a Python 3 app (Windows)?

P

Paul Moore

I want to package up some of my Python 3 scripts to run standalone,
without depending on a system-installed Python. For my development, I
use virtualenv and install all my dependencies in the virtualenv,
develop the script and test it. When I'm done, I want to build an
executable which can run without depending on a system Python. What's
the best way of doing this? I previously would have used py2exe, but
that seems not to have Python 3 support. I have heard good things
about bbfreeze, but the author has stated that he has no intention of
supporting Python 3 just yet. I've tried cx_Freeze, but I've hit a
number of niggly problems which make me think it's not quite suitable
(I've reported some of them on the cx_Freeze mailing list, but it
seems pretty quiet - no real response).

That leaves me wondering if there's another option, or whether I
should just roll my own. if I zip up the stdlib, and my virtualenv
site-packages, and then put them plus the various Python DLLs in a
directory, copy my script in, and write a small EXE to set PYTHONHOME
and run Py_Main with my script as argument, that should do. But it
seems a bit laborious :-(

Is that really the best way?

Things I care about:
- Easy to package up a script
- Works with dependencies in a virtualenv
- Completely isolated from system Python (not even leaving directories
on sys.path, so I can do basic tests without having to create a clean
system with no Python installed).

Things I don't (really) care about:
- Stripping ununsed modules (although I'd like to omit "big" parts of
the stdlib that aren't used - tkinter and test come to mind)
- Space (the full stdlib is only 30M including pyc files, after all)

Any suggestions gratefully accepted :)

Paul.
 
A

Andrew Berg

cx_Freeze is the only program that can freeze py3k code that I know of.
I didn't have any major issues with it, but I've only played with it.
In any case, if you're going to roll your own, I'd be happy to help test it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top