Mayank Pathak Mayank Pathak - 1 month ago 8
Linux Question

Building executable for linux

how do i make a linux installer from setup.py. I made an .msi from my setup.py file and here is the code for it

import cx_Freeze
executables = [cx_Freeze.Executable("Slither.py")]
cx_Freeze.setup(name="Slytherine" ,
options = {"build_exe":{"packages":["pygame"] , "include_files":["apple.png" , "snake_head.png" , "Score.dll"]}} ,
description = "Snake game" ,
executables = executables
)


What changes should be done in order to make a linux installer for it or do i have to build it on a linux machine itself?

Answer Source

Linux distributions use packages, which are usually deployed in repositories.

So you have two ways of distributing a python app.

  • Creating a python package, and uploading it to PyPI, so that users can install it with pip install yourapplication.
  • Creating linux distribution packages (.deb for debian based, rpm for redhat, ...).

I recommend reading the excellent Python Packaging user guide for understanding how does python packages work.

For linux distribution packages, well that is going to be different for every distribution, but for debian based distributions, have a look at stdeb which converts python packages into debian packages.