Question
Asked By – Georg Schölly
My application looks like this:
main.py windows/ __init__.py mainwindow.py ... model/ __init__.py orders.py ... resources/ image1.png logo.jpg ...
The program is started with main.py. Is there a good way to create a ‘final’ application out of it? I’m thinking of something like py2exe/py2app, but without copying the python interpreter / modules into the application where one has only one executable.
I had a look at distutils, but this looks like it installs a program into the Python directory, which isn’t usual on non-linux platforms.
At the moment I just copy the whole source folder onto the target machine and create an alias to main.pyw
on windows. Some inconveniences:
- The icon is the default python icon.
- I have to create the alias manually.
- In my source directory there are a lot of additional files like the source control folder.
- I have to rename
main.py
tomain.pyw
manually. - It would be nice if only `.pyo* files are on the target machine. There’s no real reason for it, I just don’t like having unnecessary files.
How does one create a nice automated distribution?
- for windows? (That’s the only platform that I have to support at the moment.)
- for mac?
- for linux?
Now we will see solution for issue: How can I distribute python programs?
Answer
The normal way of distributing Python applications is with distutils. It’s made both for distributing library type python modules, and python applications, although I don’t know how it works on Windows. You would on Windows have to install Python separately if you use distutils, in any case.
I’d probably recommend that you distribute it with disutils for Linux, and Py2exe or something similar for Windows. For OS X I don’t know. If it’s an end user application you would probably want an disk image type of thing, I don’t know how to do that. But read this post for more information on the user experience of it. For an application made for programmers you are probably OK with a distutils type install on OS X too.
This question is answered By – Lennart Regebro
This answer is collected from stackoverflow and reviewed by FixPython community admins, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0