Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Avi Tsipshtein
7,461 Pointscompiling py files into exe
Hi All,
- How can I compile py files into binary executable (exe files)?
- If I run such a compiled file on a machine without python installed on it, will it run correctly?
Thanks,
3 Answers
Fernando Zhu
22,304 PointsThere are a few libraries available to help you "freeze" your python code to exe. Check the link here. It is possible to run the exe without preinstalled python interpreter. However, it's not a good idea to ship code like that for production purpose, as the exe can be easily reverse engineered.
Steven Parker
243,318 Points
Python isn't designed to compile into a machine executable (.exe) file.
it compiles into a "byte code", which is then interpreted by the python run-time system. Both functions are built into the main "Python" program, which must be present when any Python code is executed.
Avi Tsipshtein
7,461 PointsThanks Fernando! The code is for in house use so I am not worried about reverse engineering.