How to create Standalone PYC File

Chris Rebert clp2 at
Wed Mar 4 20:43:50 CET 2009

On Wed, Mar 4, 2009 at 11:38 AM, Rohan Hole <rohanhole31 at> wrote:
> I have .py file which uses some third party modules like egg files, like
> simplejson and python-twitter ,
> ----- start of file  -----
> import ConfigParser
> import getopt
> import os
> import sys
> import twitter
> when i compile this py file using compile module , i get .pyc file . Now my
> question is , if i run .pyc file on another computer containing only python
> installed , will it run ?


> or do i need to install 3rd party lib again on
> that computer ?

Yes. The .pyc /only/ contains the code for the .py file it was
generated from; it does /not/ contain the code for any imported

> Anyone know how to make program lib independent , something
> called embedded into one file only ?

py2exe ( is the usual tool for this on Windows.
It takes a Python program and bundles it together with the Python
executable and any imported libraries to yield a standalone .exe


I have a blog:

More information about the Python-list mailing list