Is there a way to compile a python application into static binary?
<p>What I'm trying to do is ship my code to a remote server, that may have different python version installed and/or may not have packages my app requires.</p>

<p>Right now to achieve such portability I have to build relocatable virtualenv with interpreter and code. That approach has some issues (for example, you have to manually copy a bunch of libraries into your virtualenv, since <code>--always-copy</code> doesn't work as expected) and generally slow.</p>

<p>There's (in theory) <a href="https://wiki.python.org/moin/BuildStatically">a way</a> to build python itself statically.</p>

<p>I wonder if I could pack interpreter with my code into one binary and run my application as module. Something like that: <code>./mypython -m myapp run</code> or <code>./mypython -m gunicorn -c ./gunicorn.conf myapp.wsgi:application</code>.</p>