How to convert '.py' to '.exe'? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to convert '.py' to '.exe'?

Is there a way to convert a python file which uses a lot of imported modules into a stand alone executable file?

11th Feb 2017, 8:02 AM
Aditya Shukla
Aditya Shukla - avatar
2 Answers
+ 8
Yes, you can use py2exe, cx_freeze or nuitka for this. Bear in mind, though, that Python is not a compiled language - the file(s) you build will contain (import) all needed modules and... Python itself! So don't be surprised if you end up with a +20MB executable which just prints "Hello world!" ;) Also, all those builts will by default be done in your own processor architecture. If you have 64-bit Python, it just won't go on 32-bit machines. Bear that in mind.
11th Feb 2017, 11:24 AM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
0
Thanks Mr Kuba. 😀
11th Feb 2017, 11:32 AM
Aditya Shukla
Aditya Shukla - avatar