Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

My grandson is learning Python. We have installed Python 3.1.1 for him on our Windows XP (home edition). He has written a couple of short programs, and now wishes to compile those programs into machine code that he can run on a computer that does not have Python installed.

We found references to py2exe, but it appears that there is no version of py2exe for Python 3.1.1. Does anyone know of another way that we can compile his Python code into an .exe file that we can run on Windows? Has anyone tried py2exe on any version 3 of Python?

share|improve this question

2 Answers 2

Referring to an older post, you should have a look on cx_Freeze which is compatible with Python 3 :

cx_Freeze is a set of scripts and modules for freezing Python scripts into executables in much the same way that py2exe and py2app do. Unlike these two tools, cx_Freeze is cross platform and should work on any platform that Python itself works on.

share|improve this answer
    
Wow. I got a really quick answer. Thanks. cx_Freeze is not one of the references that I found using Google. I'll check it out. I'll probably need a tutorial to get it installed and tested. –  BeaG Aug 1 '10 at 0:33
    
Followup: I have installed cx_Freeze. It works fine on a simple .py program. Thanks! I have a problem on a slightly more complicated program. The .py version runs fine, but when run as .exe, it does not find the font file. The error reads as follows: Fatal Python error: <pygame parachute> Segmentation Fault. Runtime Error: default font not found 'freesansbold.ttf'. I found freesansbold.ttf in the pygames directory, so it is there, but evidently not where the executable expects to find it. I have tried placing it in several other directories, without success. Anone have ideas? –  BeaG Aug 1 '10 at 22:37
    
    
Thanks. I have now tried those suggestions, along with a few other suggestions found by Google. So far, no success. It seems to be a common problem, and what works for one person does not always work for another. When something does work in my case, I'll post the solution. I appreciate your help. –  BeaG Aug 2 '10 at 2:11

This follow up is too long for a comment, so I put it here, in the Answers. It is an answer, of sorts.

Follow up: After trying for the whole month of Aug... We finally got cx_Freeze to work on simple Python programs by finding freesansbold.ttf and putting it into the correct module in the "compiled" package. (See the second link suggestion above, given by Studer). Thanks.

We could not get the slightly more complicated Python programs to run. They still showed the Segmentation Fault.

I finally created a CD for my grandson that seems to work on Windows platforms. It is not a good solution. It is just a thing that does work for his simplified needs. I have Win7, and a CD RW that will format a CD to be used like a flash drive. I formatted a CD in this way.

Then I installed Python, using the CD as the install drive. We put my grandson's Python programs, audio, pictures, etc. on the CD in the Python32 directory. The first time the CD was used, we had to tell Windows where to find the python.exe by selecting the correct program to open the .py file. After that we could run the programs from the CD.

Not an elegant solution by any means. Not even a "fake" compile. It did solve my grandson's problem.

share|improve this answer
    
Opppps... it was the first link suggestion, given above by Studer, that worked. Sorry. –  BeaG Aug 31 '10 at 10:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.