[Tutor] cxfreeze

Eike Welk eike.welk at gmx.net
Tue Jan 12 01:24:24 CET 2010


Hello Григор!

On Monday January 11 2010 16:55:49 Григор wrote:
> Hi. Can I make exe file from python script. With cxfreeze on Windows no
>  have problem. But how make exe on ubuntu.
> 

On Linux programs are distributed as so called packages. A program called the 
package manager opens these packages and installs the programs. Ubuntu uses 
the Debian package format. These packages have the extension ".deb". 

1. Creating DEBs. 
This website seems to give a good overview (I have Suse which uses RPM 
packages, so I have no real knowledge about it.):
https://help.ubuntu.com/community/PythonRecipes/DebianPackage

An especially interesting tool seems to be this one. It creates DEBs from 
Python sources with a "setup.py" script, the next alternative which I'll 
describe:
http://pypi.python.org/pypi/stdeb/


2. Distributing sources
An other alternative is distributing the sources with a "setup.py" script. 
Pythons distutils library then installs the program in the right place. 
Distutils can also create RPMs (which are the packages for Redhat, Suse and 
Mandriva). Creating a "setup.py" script is described here (unfortunately quite 
confusing):
http://docs.python.org/distutils/index.html#distutils-index

The user would then extract the files from the archive, cd into the extracted 
directory and run "python setup.py install".

Small overview of frequently used commands of the "setup.py" script. The 
command line generally is:
    python setup.py <command>  [--dry-run]

Some commands are:
    sdist         : create source distribution. (*.tar.gz or *.zip)
    bdist_wininst : create Windows executable installer (binary
                    distribution). (*.exe)
    bdist_rpm     : create binary RPM distribution (*.rpm)
    install       : install the software
    --dry-run     : test the operation without doing anything

also useful:
    python setup.py --help
    python setup.py --help-commands


3. Run the Windows EXE on Linux. 
Wine is a set of compatibility libraries, that allow the execution of Windows 
programs on Linux. However Wine is very big and it often doesn't work very 
well, but it might be worth a try. Steps are:
- Start the package manager.
- Find Wine in the gigantic list of available packages.
- Select Wine and click on the "Install" button.
- Click the EXE file to run it.  



Eike.


More information about the Tutor mailing list