Making exe files with Python 3 in Linux?

Chat about just about anything else
Forum rules
Do not post support questions here. Before you post read the forum rules. Topics in this forum are automatically closed 30 days after creation.
Locked
RacerBG

Making exe files with Python 3 in Linux?

Post by RacerBG »

As you may already know - in my free time I use Python to lose this time. :D

I'm creating small text based games using the same "snake" language and in Windows it was rather easy to make exe files thanks to cx_Freeze. For some strange reason or lazyness I wasn't able to do the same task in Mint. For the moment I'm away from my Linux PC and I can't say what exactly goes wrong (maybe I wasn't able to install cx_Freeze on Mint) but the truth is that I never succeeded. :(

Any suggestions what can cause this problem?

Thanks in advance. :)
Last edited by LockBot on Wed Dec 07, 2022 4:01 am, edited 1 time in total.
Reason: Topic automatically closed 30 days after creation. New replies are no longer allowed.
var
Level 3
Level 3
Posts: 113
Joined: Mon Jul 14, 2014 1:29 am

Re: Making exe files with Python in Linux?

Post by var »

For Linux and Windows I use PyInstaller. A much better program and it can compile everything into a single executable, I highly recommend it.

http://www.pyinstaller.org
RacerBG

Re: Making exe files with Python in Linux?

Post by RacerBG »

var wrote:For Linux and Windows I use PyInstaller. A much better program and it can compile everything into a single executable, I highly recommend it.

http://www.pyinstaller.org
Looks nice but the latest supported version of Python is 2.7. I'm working with 3.4.1. Have you tested it under Python versions 3.x?
var
Level 3
Level 3
Posts: 113
Joined: Mon Jul 14, 2014 1:29 am

Re: Making exe files with Python in Linux?

Post by var »

I only use Python 2.7 (I dislike version 3) so I have not tested it with any other version.
RacerBG

Re: Making exe files with Python in Linux?

Post by RacerBG »

var wrote:I only use Python 2.7 (I dislike version 3) so I have not tested it with any other version.
Anyway your idea is very good and I like it but soon or later Python 2.7.x will reach it's end of life. That's why I prefer 3.x.
scryan

Re: Making exe files with Python in Linux?

Post by scryan »

change the extension to .exe
BOOM DONE!

There is no such thing in linux. Executable files are set by an executable bit in their permissions, not by the file extension as file extensions really are just a few letters at the end of the name.
You can chmod +x or right click the file and chose to make it an executable, and then at the top of the text of the file add #!/usr/bin/python to tell bash to run the file with python.
var
Level 3
Level 3
Posts: 113
Joined: Mon Jul 14, 2014 1:29 am

Re: Making exe files with Python in Linux?

Post by var »

scryan wrote:change the extension to .exe
BOOM DONE!

There is no such thing in linux. Executable files are set by an executable bit in their permissions, not by the file extension as file extensions really are just a few letters at the end of the name.
You can chmod +x or right click the file and chose to make it an executable, and then at the top of the text of the file add #!/usr/bin/python to tell bash to run the file with python.
I think he means to make the python script a self-contained executable file. Not an executable python script.

Big difference.
scryan

Re: Making exe files with Python in Linux?

Post by scryan »

var wrote:
scryan wrote:change the extension to .exe
BOOM DONE!

There is no such thing in linux. Executable files are set by an executable bit in their permissions, not by the file extension as file extensions really are just a few letters at the end of the name.
You can chmod +x or right click the file and chose to make it an executable, and then at the top of the text of the file add #!/usr/bin/python to tell bash to run the file with python.
I think he means to make the python script a self-contained executable file. Not an executable python script.

Big difference.
Would this even be done in linux?

Would any stand alone require a way to interpret python as a dependency.... so basically the same as having python on your system...
OrangeShark

Re: Making exe files with Python in Linux?

Post by OrangeShark »

You might want to check out python eggs, they are sort of like .jar files for Java. I use setuptools for some of my python projects which allows you to declare stuff like dependencies, entry points for your program, and even to install your scripts.
DrHu

Re: Making exe files with Python in Linux?

Post by DrHu »

http://www.py2exe.org/
--circa 2008, probably works with your older Python version 2.7x
scryan

Re: Making exe files with Python in Linux?

Post by scryan »

DrHu wrote:http://www.py2exe.org/
--circa 2008, probably works with your older Python version 2.7x
He is looking for a linux solution for creating exe files...

Though I am not sure if he want to make exe files for windows, since linux doesn't really have exe files, if he means he wants to create stand alone binary image of some kind, or if he just want to be able to click and run....
User avatar
xenopeek
Level 25
Level 25
Posts: 29612
Joined: Wed Jul 06, 2011 3:58 am

Re: Making exe files with Python in Linux?

Post by xenopeek »

Not sure if this is what you're looking for but, http://www.pyinstaller.org/
Image
RacerBG

Re: Making exe files with Python in Linux?

Post by RacerBG »

xenopeek wrote:Not sure if this is what you're looking for but, http://www.pyinstaller.org/
Yes, a program like this BUT for Python 3.x. No success for now except with cx_Freeze which as I already mentioned is giving some strange problems.
Locked

Return to “Open Chat”