Is there any way change a python .py script to executable file | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Is there any way change a python .py script to executable file

I need to change my python script to an independent executable file, what is the best way for it, it is a graphical Tkinter app.

26th Apr 2019, 9:11 AM
Abdol Hashimi
Abdol Hashimi - avatar
6 Answers
+ 1
Yes you can compile python file using pycompile, you can also convert your file to .exe. EDIT: here is a link: https://m.youtube.com/watch?v=lOIJIk_maO4
26th Apr 2019, 9:22 AM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 2
i think, to prevent software piracy. its pretty much a problem in many interpreted language. now that i think about it, its kinda rare to see python based application being sold
26th Apr 2019, 9:38 AM
Taste
Taste - avatar
+ 1
How to compile .py file? Python doesn't compile the code, it interpret it, it doesn't make exe file. The .py will remain .py in runtime.
26th Apr 2019, 9:21 AM
Abdol Hashimi
Abdol Hashimi - avatar
+ 1
Exactly, why compile it at all ? You can write a very simple executable file for windows and linux to execute the .py file without compiling the file itself.
26th Apr 2019, 9:32 AM
Aymane Boukrouh
Aymane Boukrouh - avatar
0
You'll have to compile it or convert it to .exe if you're on windows. EDIT: I think a better way is to keep the file as it is(so that you can modify it whenever you want to), and make a separate executable file to execute python script.
26th Apr 2019, 9:18 AM
Aymane Boukrouh
Aymane Boukrouh - avatar
0
yes its possible i think its called pyinstaller or px_freeze (im not sure). its cx_freeze not px_freeze i just look it up but its kinda beat the crossplatform concept, since exe only able to run natively in windows
26th Apr 2019, 9:26 AM
Taste
Taste - avatar