Python 3.5 + PyQt5到独立exe [英] Python 3.5 + PyQt5 to standalone exe
问题描述
我是编码的新手,我需要将py文件转换为exe.我尝试了py2exe,但它不适用于python 3.5.然后我尝试了pyinstaller并成功,但是当我将PyQt5添加到程序中时,pyinstaller也失败了.我尝试了nuitka,它生成了exe,但是当我单击exe文件时,它显示了一个控制台,并关闭了几秒钟.我需要一个被激活后显示gui的exe.这是我在程序中使用的模块:
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
我从nuitka exe文件得到错误:
Error I get from nuitka exe file:
我从pyinstaller exe文件得到错误:
Error I get from pyinstaller exe file:
Dll: dlls
推荐答案
我已经弄清楚了如何使用Python 3.5和pyinstaller制作exe.您需要安装此:
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
然后将路径添加到PyQt5 dll.我用了这个:
Then add path to PyQt5 dll's. I used this:
pyinstaller -y --clean --paths C:\TEMP\env\Lib\site-packages\PyQt5\Qt\bin\
这篇关于Python 3.5 + PyQt5到独立exe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!