r/pythonhelp • • Sep 17 '21

Is there a way to run your code?

If you made a project on Python and you want to be able to run the code on another electric without installing Python what would be the best way of doing that? Duse it have to be a game or can it be just raw code that you can run?

2 Upvotes

4 comments sorted by

4

u/[deleted] Sep 17 '21 edited Sep 17 '21

While there are some compilers that can turn python into raw machine code, python is not the best language for portability. If you're interested in one of these compilers, https://www.py2exe.org/ is probably the best known one. Good Luck!

Edit: as kokoseig pointed out below, these do not compile python. Read their comment for more detail

4

u/kokoseij Sep 17 '21

just noting, this is not turning python script into a binary. Python is script language, not intended to be compiled.

What this does instead is, It gets embedded python interpreter, your code and used libraries, and put them togethet in a single exe file so that it looks compact.

2

u/[deleted] Sep 17 '21

Thanks, I’ve edited my comment to mention that

1

u/Goobyalus Sep 19 '21

Another electric?