Python 3.5 + PyQt5 to standalone exe

佐手、 提交于 2019-12-20 03:40:27

问题


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 I get from pyinstaller exe file:

Dll's that pyinstaller needs: dlls


回答1:


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\


来源:https://stackoverflow.com/questions/40237972/python-3-5-pyqt5-to-standalone-exe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!