2

I'm new to coding and I need to transform my py file to an exe. I tried py2exe and it didn't work with python 3.5. Then I tried pyinstaller and it worked, but when I added PyQt5 to the program, pyinstaller also failed. I tried nuitka, and it builds the exe, but when I click on the exe file it shows a console for a few seconds and closes. I need an exe which shows a gui after being activated. Here are the modules that I used in the program:

import P4
import time
from datetime import datetime,date
import traceback
import os
import sys
import threading
from PyQt5 import QtCore
from PyQt5 import QtGui
from PyQt5.QtWidgets import *
from PyQt5.QtCore import QCoreApplication, QTimer

Error I get from nuitka exe file: error_0ne

Error I get from pyinstaller exe file:

Er2

Dll's that pyinstaller needs: dlls

grenfunday
  • 111
  • 3
  • 11
  • Can you run the .exe from the command line and post the error that you get? – Repiklis Oct 25 '16 at 12:55
  • @Repiklis of course, added pictures to the queastion field – grenfunday Oct 25 '16 at 13:52
  • I only have used PyQt4 with pyinstaller and not PyQt5, but you can try to modify your imports to `from PyQt5 import QtCore, QtGui`, similar to the suggested PyQt4 [method (point 2)](http://stackoverflow.com/a/8548950/3837382). This might work, but I think that it is most likely to have an issue with [the PyQt path](http://stackoverflow.com/a/2739585/3837382). – Repiklis Oct 25 '16 at 14:12
  • @Repiklis I tried, it doesn't help. I attached screenshot from pyinstaller, it says that programme can't find Qt5Core.dll and others dll's. Where i can add this files so pyinstaller could find them? – grenfunday Oct 25 '16 at 16:34
  • The best way (personal opinion) is to use a `.spec` file and use [this](https://pythonhosted.org/PyInstaller/spec-files.html#adding-files-to-the-bundle). – Repiklis Oct 26 '16 at 08:08

1 Answers1

5

I've figured out how to make an exe with Python 3.5 and pyinstaller. You need to install this:

pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip --upgrade

Then add path to PyQt5 dll's. I used this:

pyinstaller -y --clean --paths C:\TEMP\env\Lib\site-packages\PyQt5\Qt\bin\
grenfunday
  • 111
  • 3
  • 11