0

NOTE: Before marking this as duplicate please read the whole post first

I'm trying for hours to convert my python 3.6 code to exe, I've searched everywhere and tried everything, the most helpful place was there: Best method of converting .py to .exe for Python 3.6?

So apparently there are only 3 ways of converting py to exe:

  1. PyInstaller
  2. Py2exe
  3. Cxfreeze

Pyinstaller doesn't support Python 3.6, and py2exe is very outdated.

As for cxfreeze, it sounds like it supports Python 3.6, so that's the route that I've taken.

I've searched everywhere on how to use cxfreeze, unfortunately, all guides that I have found seem to be outdated:

http://cx-freeze.readthedocs.io/en/latest/overview.html this guide for example has three routes, two of which doesn't work (The first gives me a .spec file that i dont know what to do with it and the second gives me an error because i dont have the cxfreeze.util module) and the 3rd is too complicated for my tastes

How do I use cx_freeze? this uses the second route, still it doesn't work

Community
  • 1
  • 1
  • 1
    Pyinstaller 3.6 support is rapidly improving. You might trying using the [development tip](https://github.com/pyinstaller/pyinstaller/wiki/How-to-Report-Bugs#before-submitting-a-report). – Stephen Rauch Mar 02 '17 at 06:45

1 Answers1

0

I'm not allowed to comment for some reason, so this isn't really an answer, but for my part I installed cx_Freeze from https://pypi.python.org/pypi/cx_Freeze

When you install it, there's an extra step that's not documented. Using the Windows CMD shell, go to your python installation directory, into the Scripts sub-directory and you will find a few files called cxfreeze...

You need to create the batch file by typing python cxfreeze-postinstall

A file called cxfreeze.bat will be created which you can move into your main python folder or wherever your python program is located.

Then type cxfreeze mypythonprogram.py --target-dir dist

This should create a working exe in the dist directory. However, it doesn't work for me as I get an error in the finder.py file which is part of the cxfreeze installation so I don't know if I've done something wrong or this version is completely buggy.

edit: by commenting out line 561 in the finder.py file (C:\Python\Python36-32\Lib\site-packages\cx_Freeze\finder.py on my system) I was able to run it and Generate the EXE which appears to run OK.

pickarooney
  • 385
  • 2
  • 18
  • 1
    unfortunately I am unable to run the EXE on another PC, even by copying the whole dist folder. When I run it from CMD on the second PC it looks for a load of python files. Basically you need to install python in exactly the same structure as on the development PC or it won't work. This is very disappointing... I'm not sure how anyone is supposed to develop python programs for public distribution on windows. – pickarooney Mar 08 '17 at 11:06
  • I tried using pyinstaller as an alternative but that doesn't support python 3.6 and crashes out. – pickarooney Mar 08 '17 at 11:16
  • The dev version 3.3 runs without errors but does nto create an EXE, rather a .pyc file which of course cannot be run on a PC without Python installed – pickarooney Mar 08 '17 at 11:28