Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to build .exe for python 3.5+, 3.6 if possible?

Is there now an easy protocol to build a .exe from python 3.5+, using modules pyqtgraph, qt5, theano, pymc3, numpy, scipy, os and sys, and opening a simple GUI stored in a '.ui' file ? I lost hours and eventually failed to make one (for w7-64 bits). Help !

preliminary failure with py2exe: I first install py2exe for python 3 but it turns out this is not compatible with my python 3.6 yet, so I downgraded to python 3.5… to get a bunch of errors. Then I went to forums and tried the proposed cures but failed (I’m uneasy with windows), the alternative being to downgrade to python 3.4… So I downgraded to python 3.4 to get an error concerning a missing ‘msvcr100.dll’ that I tried to install following instructions on forums but by default I don’t have the permission to modify system directories… When I eventually had this permission it turns out the ‘regsvr32’ command fails (isn’t this for 32 bits ? but there is no ‘regsvr64’…). Following episodes are described below.


update august 23, 2017, 1pm:

  • I also tried pyinstaller as advised but it failed (see my related question build a .exe for Windows from a python 3 script importing theano with pyinstaller)

  • I also tried cx_freeze but it failed (see my related question build a .exe for Windows from a python 3 script)

  • I also tried pynsist but it fails (same link than above)

what's next ?


update september, 2, 2pm:

I eventually managed to build a .exe with pyinstaller after many episodes.

Unfortunately I failed to deal with the ‘theano’ module (that is required in my case by the ‘pymc3’ module) and I had to modify the .py files and give up part of the application. Could anyone help me building a .exe for windows 7+, with the ‘theano’ module ?

see build a .exe for Windows from a python 3 script importing theano with pyinstaller

like image 327
Stéphane Avatar asked Jun 13 '17 08:06

Stéphane


2 Answers

Pyinstaller Works with Python 3.5 and it is working even for packages like tensor-flow, scipy , etc (The packages I worked with)

py -3.5 pip install pyinstaller

then go the C:\Users\user\AppData\Local\Programs\Python\Python35\Scripts and run the command

pyinstaller <code .py file along with directory> --onefile

--onefile : is for compressing the build and get a single file as output

like image 64
Ravi Kumar Avatar answered Sep 20 '22 22:09

Ravi Kumar


I would suggest pyinstaller see http://www.pyinstaller.org/

The pyinstaller already supports 3.5

The development version supports 3.6

like image 31
milo Avatar answered Sep 17 '22 22:09

milo