加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Python > 正文

使用Pyinstaller编译PyQt4时出错

发布时间:2020-12-20 13:26:14 所属栏目:Python 来源:网络整理
导读:在过去,我使用pycompiler(或’pyinstaller’)将我使用PyQt4框架的程序编译成可执行代码,这只是因为py2exe. 我最近换了电脑,还没有设法编译我的PyQt4程序! 在这台计算机中,我设置了一个环境变量%pycompile%,它具有pyinstaller.py文件的目录. 这是我插入cmd
在过去,我使用pycompiler(或’pyinstaller’)将我使用PyQt4框架的程序编译成可执行代码,这只是因为py2exe.
我最近换了电脑,还没有设法编译我的PyQt4程序!

在这台计算机中,我设置了一个环境变量%pycompile%,它具有pyinstaller.py文件的目录.

这是我插入cmd.exe的代码,即使用python代码NOT IMPORT PYQT4.

python %pycompile% --noconsole myscript.pyw

但是,当我尝试编译基于PyQt4的程序时,我会在尝试编译PyQt4程序时从pyinstaller.py导入的python文件中获得一个语法错误(通过我的解释).
“exec_ = exec”

E:ChemCalc ULTIMATEChemCalc ULTIMATE>python %pycompile% Penny.pyw
I: skip Configure.py,use existing config C:Python27PyCompileconfig.dat
wrote E:ChemCalc ULTIMATEChemCalc ULTIMATEPenny.spec
I: Dependent assemblies of C:Python27python.exe:
I: x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8_none
checking Analysis
building Analysis because outAnalysis0.toc non existent
running Analysis outAnalysis0.toc
Analyzing: C:Python27PyCompilesupport_mountzlib.py
Analyzing: C:Python27PyCompilesupportuseUnicode.py
Analyzing: Penny.pyw
Syntax error in exec_py3.py
('invalid syntax',('exec_py3.py',1,12,'exec_ = execn'))
Traceback (most recent call last):
  File "C:Python27PyCompilepyinstaller.py",line 187,in <module>
    main(parser)
  File "C:Python27PyCompilepyinstaller.py",line 76,in main
    run_build(opts,args,spec_file)
  File "C:Python27PyCompilepyinstaller.py",line 52,in run_build
    Build.main(spec_file,configfilename=opts.configfile)
  File "C:Python27PyCompileBuild.py",line 1472,in main
    build(specfile)
  File "C:Python27PyCompileBuild.py",line 1429,in build
    execfile(spec)
  File "E:ChemCalc ULTIMATEChemCalc ULTIMATEPenny.spec",line 3,in <module>
    pathex=['E:ChemCalc ULTIMATEChemCalc ULTIMATE'])
  File "C:Python27PyCompileBuild.py",line 347,in __init__
    self.__postinit__()
  File "C:Python27PyCompileBuild.py",line 298,in __postinit__
    self.assemble()
  File "C:Python27PyCompileBuild.py",line 416,in assemble
    analyzer.analyze_script(script)
  File "C:Python27PyCompilemf.py",line 572,in analyze_script
    return self.analyze_r('__main__')
  File "C:Python27PyCompilemf.py",line 466,in analyze_r
    newnms = self.analyze_one(name,nm,imptyp,level)
  File "C:Python27PyCompilemf.py",line 525,in analyze_one
    mod = self.doimport(nm,ctx,fqname)
  File "C:Python27PyCompilemf.py",line 587,in doimport
    mod = parent.doimport(nm)
  File "C:Python27PyCompilemf.py",line 761,in doimport
    mod = self.subimporter.getmod(nm)
  File "C:Python27PyCompilemf.py",line 355,in getmod
    mod = owner.getmod(nm)
  File "C:Python27PyCompilemf.py",line 117,in getmod
    co = compile(string.replace(stuff,"rn","n"),py[0],'exec')
  File "exec_py3.py",line 1
    exec_ = exec
               ^
SyntaxError: invalid syntax

我正在使用与我以前在旧计算机上使用的pycompile相同的构建(216).它们都运行32位Windows,32位python 2.7.2.

所有帮助都需要!
(我很害怕我的MASSIVE编程项目无法编译!)

我已经阅读了很多关于PyQt的pyinstaller错误的Stack问题,但不是我特别的错误!

谢谢!

我的代码以:

import sys
import getpass
import hmac
import random
import shutil
from PyQt4 import QtGui,QtCore
from RegMenu import Ui_RegristrationMenu
from ChemWindow import Ui_ChemWindow
from ReactionClass import ReactionElement
from StoichUnitSelectionClass import Ui_StoichUnitSelection
from VisualTool import Ui_Aesthetics_Tool
import decimal  
import sympy  
import math

并结束于:

sys.exit(ApplicationRun.exec_())

python 2.7.2(32位)
pycompile build(216)
PyQt4(4.5)
Windows 7(32位)

解决方法

由Avaris的共享建议修复.
http://code.google.com/p/mpmath/issues/detail?id=204

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读