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

Discussion in 'Python' started by Paul Moore, Apr 3, 2012.

  1. Paul  Moore

    Paul Moore Guest

    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.
     
    Paul Moore, Apr 3, 2012
    #1
    1. Advertising

  2. Paul  Moore

    Andrew Berg Guest

    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.

    --
    CPython 3.2.2 | Windows NT 6.1.7601.17640
     
    Andrew Berg, Apr 3, 2012
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. tom
    Replies:
    4
    Views:
    14,251
    jpowers5882
    Oct 24, 2008
  2. Nick
    Replies:
    2
    Views:
    900
    Miki Tebeka
    Jan 19, 2004
  3. Tsubasa[Hokage]
    Replies:
    0
    Views:
    510
    Tsubasa[Hokage]
    Jan 26, 2005
  4. Replies:
    5
    Views:
    271
    Olivier Renaud
    Mar 15, 2007
  5. Greg Hauptmann
    Replies:
    7
    Views:
    188
    CParticle
    Sep 15, 2009
Loading...

Share This Page