title: Compiling Python to native code?
body: <blockquote>
  <p><strong>Possible Duplicate:</strong><br />
  <a href="https://stackoverflow.com/questions/138521/is-it-feasible-to-compile-python-to-machine-code">Is it feasible to compile Python to machine code?</a></p>
  </blockquote>
  
  <p>Is it possible to compile Python code (plus its dependencies, plus the interpreter library) into <strong>a single, <em>native</em></strong> Windows executable (with <em>nothing</em> else bundled along with it) from a Python file? (Kind of like how the GNU compiler for Java compiles Java into a <em>native</em> (humongous) executable, which contains everything in true machine code.)</p>
  <p>If so, how would I go about doing this?</p>
  <p>(Specifically, <code>py2exe</code> does <em>not</em> do what I want -- it includes the libraries inside a <em>separate</em> ZIP file, and it includes the interpreter as a <em>separate</em> DLL.)</p>
  <h3>Note 1:</h3>
  <p>To emphasize, I'm <em><strong>not</strong></em> asking for a &quot;self-extracting archive&quot;, an &quot;executable packer&quot;, or some other way of 'cheating' by bundling the files inside an <code>exe</code> -- I'm looking for something that genuinely converts Python into a native executable, like what GCJ does for Java.</p>
  <h3>Note 2:</h3>
  <p>Only if the above <em>isn't</em> possible:</p>
  <p>Is it possible to at least generate a <em>single</em> executable from a Python code containing the interpreter bundled along with all the library dependencies, such that the resulting executable does <em>not</em> need to self-extract onto the target disk before running?</p>
  <p>In this scenario, the 'compilation' requirement is relaxed: it doesn't matter if the code is actually compiled into machine code (it could simply be embedded as a text resource into the target executable), but the result must nevertheless be a <em>single</em> <code>exe</code> file [and nothing else] that can run standalone, specifically <em>without</em> needing to unpack/install anything onto the target disk before running.</p>