r/pythontips • u/[deleted] • Apr 18 '21
Python3_Specific .py to .exe
I want to make a python program into an executable. I have heard that you have to use pyinstaller, but I just want to know if there is any other way that I can it without pyinstaller.
7
u/Kurgan182 Apr 18 '21
Py installer is broke af, always have to hidden import libs, and after all it keeps crash... I don't like it too
10
u/kepevem Apr 18 '21
2
u/Suisanahta Apr 18 '21
Yup, py2exe does the job for an OSS project I now maintain related to the game Elite Dangerous.
The current maintainer of py2exe is doing a good job of updating it for the foibles of various python modules as they're reported.
5
u/louvrethecat Apr 18 '21
You can make a bat file that starts the script. You'll still need all your libraries installed tho.
There's also a program out there, can't remember it's name, that creates an exe file of your bat file. You can also add an icon
9
u/trevtravtrev github.com/trevtravtrev Apr 18 '21
This is the way. Bat file for windows, shell file for Linux
9
u/SloppyPuppy Apr 18 '21 edited Apr 19 '21
Frankly, I dont think python is really meant to be used this way. of course it can be done and all. but if you have the need to run this as a binary executable for your reasons, those reasons might lead you to be using a different programing language.
4
u/MeDotPy Apr 18 '21
Python may break a lot when it is "compiled" so you may not want to have to deal with bugs and stuff that breaks when you try to do so.
I would recommend if it is a very small program to use another programming language that can be compiled. If it is a big pogram instead I would recommend just to state it requires python3.x.x and some specific libraries to work and so.
If you really want to be able to read easily and compile your code, there are many other programming languages that can do the work and aren't too hard to learn and you won't have to deal too much with compiling issues.
1
u/SloppyPuppy Apr 19 '21
Follwoing what this guy is saying. Use pip freeze. It will install all dependencies and packages with the specific versions. So you dont have to worry about future stuff breaking your code
2
u/MyPythonDontWantNone Apr 18 '21
In addition to the other options mentioned, you may also consider using Flask or Django to make it a web app. Then it is cross-platform.
2
1
u/TeslaRanger Apr 18 '21
There’s one for making Mac OS X standalone apps too (py2app); have not tried it myself, was just curious.
1
u/moksh2812 Apr 19 '21
Pyinstaller will do your job i guess. It has a lot of cool functions and after building a exe file you can also edit the .spec file if needed
1
u/acecabana Apr 19 '21
Never had an issue using pyinstaller. Have built multiple tools in python and created exes out of them for colleagues to use without having to know python or install local libraries.
14
u/elephantail Apr 18 '21
Mind me asking, is there a specific reason why you don't want to use pyinstaller?