Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Python: how can I create a bin file of a python program?

  1. #1
    Join Date
    Mar 2007
    Location
    Lyngen, Norway
    Beans
    163
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    Question Python: how can I create a bin file of a python program?

    Is there a way to create a bin file of a Python program?

    I want a bin file like when you compile a program from source.



    Thanks
    IBM Thinkpad R60
    Ubuntu user: # 14440
    Please visit:
    http://www.fablab.no

  2. #2
    Join Date
    Feb 2006
    Location
    Québec, Canada
    Beans
    Hidden!
    Distro
    Gutsy Gibbon Testing

    Re: Python: how can I create a bin file of a python program?

    Since python is a scripting language, it doesn't produces binaries. It is compiled at run-time.

    Tho, you still can get some .pyc files, as I understood those are semi-compiled files. Unless you want to close the sourcre from being seen/edited, I don't see why someone would do such a thing, tho.

  3. #3
    Join Date
    Mar 2007
    Location
    Lyngen, Norway
    Beans
    163
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    Re: Python: how can I create a bin file of a python program?

    Quote Originally Posted by Foxmike View Post
    Since python is a scripting language, it doesn't produces binaries. It is compiled at run-time.

    Tho, you still can get some .pyc files, as I understood those are semi-compiled files. Unless you want to close the sourcre from being seen/edited, I don't see why someone would do such a thing, tho.
    OK, Thank you.
    IBM Thinkpad R60
    Ubuntu user: # 14440
    Please visit:
    http://www.fablab.no

  4. #4
    Join Date
    Jun 2006
    Location
    CT, USA
    Beans
    5,267
    Distro
    Ubuntu 6.10 Edgy

    Re: Python: how can I create a bin file of a python program?

    Binary for which platform? There are compilers, which can compile .pyc further to real binaries (like psyco), but not many people bothers with it. Why you need it?

    BTW .pyc files are compiled to intermediate code, so they can be executed rather efficiently. They are not interpreted at the runtime like classic "scripting" language do, whatever "scripting" means.

  5. #5
    Join Date
    Mar 2007
    Location
    Lyngen, Norway
    Beans
    163
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    Wink Re: Python: how can I create a bin file of a python program?

    Quote Originally Posted by pmasiar View Post
    Why you need it?

    I have a project on sf.net, and I wanted more versions of it...
    IBM Thinkpad R60
    Ubuntu user: # 14440
    Please visit:
    http://www.fablab.no

  6. #6
    Join Date
    Jun 2006
    Location
    CT, USA
    Beans
    5,267
    Distro
    Ubuntu 6.10 Edgy

    Re: Python: how can I create a bin file of a python program?

    Quote Originally Posted by holihue View Post
    I wanted more versions of it...
    this is not your business goal. What you want to accomplish?

  7. #7
    Join Date
    Feb 2006
    Location
    Québec, Canada
    Beans
    Hidden!
    Distro
    Gutsy Gibbon Testing

    Re: Python: how can I create a bin file of a python program?

    Quote Originally Posted by pmasiar View Post
    Binary for which platform? There are compilers, which can compile .pyc further to real binaries (like psyco), but not many people bothers with it. Why you need it?

    BTW .pyc files are compiled to intermediate code, so they can be executed rather efficiently. They are not interpreted at the runtime like classic "scripting" language do, whatever "scripting" means.
    Thanks for the precision!

  8. #8
    Join Date
    Oct 2007
    Beans
    130
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: Python: how can I create a bin file of a python program?

    There are python "compilers" out there that wrap up all your modules and the interpreter into an executable. I've found this useful for distributing software to Windows users, although you can also get "compilers" for linux,BSD,OSX etc.

    One thing you do need to be aware of if you are thinking of distributing .pyc files is that the .pyc file format is interpreter-dependent, so if you have python 2.4 and you give your pyc files to someone with python 2.1 they probably won't run.

    This can also be a problem for code, Python is a fairly new language and as such it's changing constantly. The only way to ensure your app will continue to run on later versions of python is to package it as above so it is run on the correct interpreter. Of course, most apps should continue to run fine (unless they do decide to remove lamda: and map.)


    p.s. Psyco isn't a packager, but a JIT compiler that kind of reduces the cost of python's dynamic typing.
    Last edited by evymetal; October 29th, 2007 at 09:54 AM. Reason: addition

  9. #9
    Join Date
    Mar 2005
    Beans
    423

    Re: Python: how can I create a bin file of a python program?

    Python is actually 16 years old.
    Travis Watkins
    Blog: Realist Anew
    Projects: Compiz

  10. #10
    Join Date
    Nov 2006
    Location
    United States
    Beans
    665
    Distro
    Ubuntu Development Release

    Re: Python: how can I create a bin file of a python program?

    There is a setup.py script out there... I use it for KernelCheck.
    The one and only, Master Kernel Thread
    KernelCheck - Finally. A way to easily download, compile, and install the latest kernel. Release 1.2.5 available now.

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •