Hello. Suppose there is a game written in Python 3. It uses pygame and imported modules from subdirectories.

What should be done with this game, so that instead of getting .py files, as a result, get binaries for different operating systems ( .exe with Windows icon, Linux executable, etc.) and an installation file that install dependencies in the form of Python 3 and pygame, created shortcuts?

Modules from subdirectories must be .pyc .

In general, it is necessary that the source code is inaccessible to change and a regular user can install a game with a couple of clicks without any problems and start playing.

How can I do that?

At the moment, the game is launched only through the terminal, which is not good for such a project.

  • The source code in any case will remain available for change - andreymal
  • one
    Look at py2exe, cx_Freeze and other similar projects. - jfs

1 answer 1

In my opinion, the best option is to distribute the game package with virtualenv. In the project directory, make a file main.py, from which you will build an exe file for the user, which in turn will download and install the necessary dependencies.