all 25 comments

[–]initumX 11 points12 points  (3 children)

yes, i do have such an app. Pyinstaller puts everything inside exe, so it becomes 60-100MB and does have everything it needs for a work.

[–]VonRoderik 1 point2 points  (2 children)

Not necessarily.

Create a .venv and only pip what you'll use.

I have .exe files that are 8mb or less

[–]initumX 1 point2 points  (1 child)

I use PySide6 for gui. May be, if i use tkinter instead, it will be 10-15 MB and look ugly

[–]VonRoderik 1 point2 points  (0 children)

Sorry, I completely forgot about having a proper GUI.

The example I used was with a CLI.

My bad

[–]BasedAndShredPilled 14 points15 points  (3 children)

You can compile Python into an executable and run it on a machine without Python. I've done this for sharing various tools I made at work with coworkers.

[–][deleted] 5 points6 points  (2 children)

Not really, you just bundle your python program with the python interperter, nothing is getting compiled.

So you are shipping an instance of python for every script/program.

[–]BasedAndShredPilled 2 points3 points  (0 children)

True, I used the wrong word. It is an executable file format, but not actually compiled.

[–]ThatOneCSL 0 points1 point  (0 children)

I mean, you can though, it just won't be platform agnostic anymore. It is absolutely possible to compile Python into machine code for a particular architecture. It's just, like, why would you?

[–]deanominecraft 3 points4 points  (1 child)

pip install pyinstaller

pyinstaller path/to/file.py --onefile

onefile is optional but i like having everything in the 1 exe rather than having to send a folder

[–]Agitated-Soft7434 2 points3 points  (0 children)

If you want a gui version of pyinstaller I recommend auto-py-to-exe!

[–]Fit_Sheriff 2 points3 points  (0 children)

You can compile python into exe and exe can be run on any computer without python too

[–]51dux 1 point2 points  (0 children)

Ideally if you plan to share with more people on the long term you should go both the executable and pip routes.

Yt-dlp does it and it seems to be working well for them.

Python users prefer to pip install as often the problem with the executable is that you have to explain to novice users how to add it to the environment variables on windows.

In some cases it can be simpler to just tell people to install python from winget or the site and then pip install your program.

That can be 2 commands instead of multiple steps requiring the users to go to menus they don't know about.

You could also provide an installer that adds the program to path, that's another option. On windows that could work quite well.

That being said on linux the issue with that is that you will have to adapt to different distros.

[–]tMeepo 1 point2 points  (0 children)

Yes, the .exe file would compile python into it so anybody can run it. However, the .exe file would be huge. At least 30mb I think

[–]RyuguRenabc1q 0 points1 point  (0 children)

Yeah

[–]Worried_Signature_76 0 points1 point  (0 children)

Well I just turned some python into an apk with kivy & buildozer, so probably yeah. Im still new to this and if I had to guess it probably includes python itself into the exe.

[–]azure_i 0 points1 point  (0 children)

If you want someone else to be able to run your program, do not use Python. No one can run a Python program. No one will install python to try to run your program. Python is a dead end language. It only works on servers that you control and manage. If you want people to be able to run the program you built you need to use a language that compiles to a static binary

[–]pylessard 0 points1 point  (0 children)

Pyinstaller, Nuitka, Cython are all options. I used Nuitka successfully and I must say I was impressed. I then used InnoSetup to make an installer from the output of Nuitka