Thread: Compiler?

    #1
  1. No Profile Picture
    Roving Icicle
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2001
    Location
    Netizen
    Posts
    56
    Rep Power
    14

    Compiler?


    This may seem like a wierd newbie question to be asking, but here goes.

    Is it possible to compile Python? I know PHP can be thanks to Zend but is there any Python equivilant?

    Comments on this post

    • Gran Roguismo agrees
    Is it just me or is it cold in here?
  2. #2
  3. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,638
    Rep Power
    4247
    If I recall correctly, the Python interpreter comes with a built in byte-compiler. You might want to try this (assuming that you want to byte compile a file called foobar.py):

    Code:
    #!/usr/bin/python
    
    import py_compile
    py_compile.compile("foobar.py")
    This will create a byte-compiled python file called foobar.pyc. Is this what you're looking for?
  4. #3
  5. No Profile Picture
    Python Prophet
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2001
    Location
    Amersfoort, The Netherlands
    Posts
    45
    Rep Power
    14
    If you want to make Python programs run stand-alone, take a look at the Python FAQ, and search for Freeze.

    If you want to compile them, use Scorpions4ever's answer.
    Some people, when confronted with a problem, think I know, I'll use regular expressions. Now they have two problems. - Jamie Zawinski, in comp.lang.emacs
  6. #4
  7. No Profile Picture
    Roving Icicle
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2001
    Location
    Netizen
    Posts
    56
    Rep Power
    14
    Standalone is what I was looking for, sorry if I was vague. Thank you both for the info.
    Is it just me or is it cold in here?
  8. #5
  9. chown python:users\ /world
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Texas Tech
    Posts
    95
    Rep Power
    15
    You should also have a look at http://starship.python.net/crew/theller/py2exe/

    It allows you to create standalone *.exe files (command line and Windowed versions). Pretty cool stuff
    Hartmann
    badice.com

IMN logo majestic logo threadwatch logo seochat tools logo