0

I very recently wrote a program for a friend where it simplifies some important daily calculations for him/her. Now, the problem I am having is that I want to compile the code into an executable program so that he/she can comfortably run it on their machine, perhaps with a simple graphical interface or whatnot.

I have tried using cx_Freeze with Python 3.3.0 64 bit but to no avail (the program simply refuses to start on their machine; I even tried generating an executable via 32-bit Python, but also to no avail). What I then thought was that I could perhaps generate an executable program via PyGame? But the fact of the matter is that I have never used any Python-related program except the IDLE, so I am not sure what to do and look for.

Another option would perhaps be to convert the Python 3.3.0 code to Python 2.x, but the problem is that I am not familiar with Python 2.x and neither is there any automated converter available (as far as I know). I was wondering whether anyone of you could direct me to any good sources/links, since those I have been ferociously Googling are rather inconcrete.

kapython
  • 131
  • 1
  • 6
  • Try this : [PyInstaller](http://www.pyinstaller.org/) – Thanakron Tandavas Mar 24 '13 at 11:27
  • 1
    For just one machine, why don't you simply install Python 3.3 on it with the dependencies? Name the main script `__main__.py`, zip all the files, and change the extension to `.pyw`. – Eryk Sun Mar 24 '13 at 12:03
  • PyInstaller is not compatible with Python 3.x, but thank you anyway. @eryksun: I suppose I could do that. The program is just one .py-file, how exactly do I go about with the zipping and renaming? – kapython Mar 24 '13 at 12:40
  • @eryksun: Ok, but I need to obtain the dependencies and include them in the files I am going to send to my friend. Hm, what are you referring to when you write "pylauncher"? – kapython Mar 24 '13 at 15:05
  • 1
    Note that if you use cx_Freeze, you need to copy the files it saves alongside the executable - usually some DLLs and possibly a zip file. The .exe won't work without those. – Thomas K Mar 24 '13 at 18:54
  • Which OS are you using? – LtWorf Mar 30 '13 at 00:14
  • Possible duplicate of [How do I compile my Python 3 app to an .exe?](http://stackoverflow.com/questions/17907258/how-do-i-compile-my-python-3-app-to-an-exe) – Cees Timmerman May 18 '17 at 14:28

3 Answers3

0

You could just use py2exe. It is compatible with python 3. I have seen tutorials for it on youtube.

John Gann
  • 595
  • 6
  • 13
panpog
  • 11
  • 2
  • py2exe don't appear to support Python 3 yet. There's a `py3exe` effort in the repository, but it doesn't look like it's ready to use yet, and it hasn't seen any commits in a few months. – Thomas K Oct 29 '13 at 17:07
0

You could try embedding it in a C program, and compiling that for your executable. A decent tutorial is in the python docs at http://docs.python.org/2/extending/embedding.html

John Gann
  • 595
  • 6
  • 13
0

PyInstaller "is a program that converts (packages) Python programs into stand-alone executables, under Windows, Linux, Mac OS X, Solaris and AIX" and gives you one standalone executable file.

Even as a noob Python user I have succeeded to pack my app using PyInstaller (relatively) easily.

Kaveh Shahbazian
  • 13,088
  • 13
  • 80
  • 139