0

How to convert the Python program to exe without any errors ?

I try to convert my Python gui program to exe i face lots of problem how did i solve that ? Note: my program run good when i run in .py extension

23rd Dec 2019, 2:18 AM
Programmer Raja
Programmer Raja - avatar
8 odpowiedzi
+ 2
Randych pyinstaller is usually included with python, no need to install it tbh. python is more than fine for desktop applications. if your code is short indeed and doesn't use many imports, the file will be about 6-7mb. the file size is entirely unrelated to being high level by the way. it's because python embeds itself as a VM in that .exe, and this means cross-platform compatibility and no requirements like 3rd party redistributables - both of which is generally not true for C/C++ or C#. also, a few mb are a non-issue in 2019/2020, even with bad internet.
24th Dec 2019, 3:44 AM
grdr
+ 1
pyinstaller script.py -F
23rd Dec 2019, 4:24 AM
grdr
+ 1
Programmer Raja (தமிழன்) search its name in Google there you can find it
23rd Dec 2019, 12:03 PM
Abdol Hashimi
Abdol Hashimi - avatar
+ 1
If you're using PyCharm, you can install Pyinstaller in Package Manager, then you need to define it as external tool and then use for your project. Problem is that it has a little use since Python is too high level language and thus you may get 10-40 Mbyte large exe just for a program with few tens of lines. If you indeed intend to develop autonomous executables, maybe take a look at C family instead?
24th Dec 2019, 3:37 AM
Randych
Randych - avatar
+ 1
I believe the main intention behind creating Python was to create something that's fun to use, easy to learn and able to convey reasonable coding standards. And yeah, it's not the best language to create small executables that only carry out minor tasks, but bigger projects don't result in equivalently bigger file sizes. The base file size is pretty high, can't argue with that. But it only gets much bigger when you import a large amount of big libraries and/or add other resources (such as images). Not to mention you can just omit the -F parameter to get a folder instead of a single file... like I said, I don't think people have such bad internet anymore. If we're talking about developing something like firmware for a thermostat where the device has extremely little space for your binary (and possibly more important: limited RAM), you're obviously MUCH better off using C++. For modern computers, however, it probably doesn't make a difference, and pyinstaller is an awesome tool to just share your first few projects with friends who are not gonna bother installing python just to run your stuff. As for myself, I made the mistake of starting to learn Python in the context of "Ethical Hacking", so my friends don't trust anything I send for some reason. :(
24th Dec 2019, 4:10 AM
grdr
0
Use this app (Py2EXE)
23rd Dec 2019, 5:16 AM
Abdol Hashimi
Abdol Hashimi - avatar
0
Saboor Hakimi how to get that app ?
23rd Dec 2019, 6:20 AM
Programmer Raja
Programmer Raja - avatar
0
Gregor Dietrich I totally agree with you, but still even 10Mb is a bit overkill and not what's Python is generally intended for imho.
24th Dec 2019, 4:01 AM
Randych
Randych - avatar