• 解决Pyqt打包后运行报错:应用程序无法启动 因为程序的并行配置不正确


    做了一个生成二维码的小程序:http://www.cnblogs.com/dcb3688/p/4241048.html

    直接运行脚本没问题,用pyinstaller打包后再运行就直接报错了:

    应用程序无法启动 因为程序的并行配置不正确。有关详细信息,请参阅应用程序事件日志,或使用命令行 sxstrace.exe 工具。

    网上找的解决方法:

    1.   安装Microsoft Visual C++ 2008 Redistributable

    2.  开始 - 运行(输入services.msc)- 确定或回车,打开:服务(本地),开启Windows Modules Installer服务

           

    第一种,我电脑已经安装VC2008,且VC2005 和VC2010 都安装了,  排除!

    第二种,打开本地服务,发现Windows Modules Installer  已经是开启的, 排除!

    所以还是在打包的信息中寻找线索吧

    找打包时的信息分析后发现:

    1 19753 INFO: Looking for run-time hooks
    2 19754 INFO: Analyzing rthook C:Python27libsite-packagespyinstaller-2.1.1.dev0-py2.7.eggPyInstallerloader
    thookspyi_rth_qt4plugins.py
    3 19845 INFO: Analyzing rthook C:Python27libsite-packagespyinstaller-2.1.1.dev0-py2.7.eggPyInstallerloader
    thookspyi_rth_PIL_Image.py
    4 19954 INFO: Analyzing rthook C:Python27libsite-packagespyinstaller-2.1.1.dev0-py2.7.eggPyInstallerloader
    thookspyi_rth_Image.py
    5 22815 INFO: Adding Microsoft.VC90.DebugCRT to dependent assemblies of final executable
    6 22894 INFO: Searching for assembly x86_Microsoft.VC90.DebugCRT_1fc8b3b9a1e18e3b_9.0.21022.8_none ...
    7 22894 WARNING: Assembly not found
    8 22894 ERROR: Assembly x86_Microsoft.VC90.DebugCRT_1fc8b3b9a1e18e3b_9.0.21022.8_none not found
    9 23014 INFO: Searching for assembly x86_Microsoft.VC90.DebugCRT_1fc8b3b9a1e18e3b_9.0.21022.8_none ...

    是缺少VC90.CRT,但在系统中是可以找的到的:

     1 608 INFO: wrote E:wwwpyqtTESTqrcode_a.spec
     2 684 INFO: Testing for ability to set icons, version resources...
     3 888 INFO: ... resource update available
     4 892 INFO: UPX is not available.
     5 1000 INFO: Processing hook hook-os
     6 1273 INFO: Processing hook hook-time
     7 1279 INFO: Processing hook hook-cPickle
     8 1434 INFO: Processing hook hook-_sre
     9 1914 INFO: Processing hook hook-cStringIO
    10 2136 INFO: Processing hook hook-encodings
    11 2161 INFO: Processing hook hook-codecs
    12 4158 INFO: Extending PYTHONPATH with E:wwwpyqtTEST
    13 4161 INFO: checking Analysis
    14 4161 INFO: Building Analysis because out00-Analysis.toc non existent
    15 4161 INFO: running Analysis out00-Analysis.toc
    16 4162 INFO: Adding Microsoft.VC90.CRT to dependent assemblies of final executable
    17 11481 INFO: Searching for assembly x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8_none ...
    18 11485 INFO: Found manifest C:WindowsWinSxSManifestsx86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.21022.8_none_bcb86ed6ac711f91.manifest
    19 11508 INFO: Searching for file msvcr90.dll
    20 11509 INFO: Found file C:WindowsWinSxSx86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.21022.8_none_bcb86ed6ac711f91msvcr90.dll
    21 11510 INFO: Searching for file msvcp90.dll
    22 11511 INFO: Found file C:WindowsWinSxSx86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.21022.8_none_bcb86ed6ac711f91msvcp90.dll
    23 11513 INFO: Searching for file msvcm90.dll
    24 11513 INFO: Found file C:WindowsWinSxSx86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.21022.8_none_bcb86ed6ac711f91msvcm90.dll
    25 11827 INFO: Analyzing C:Python27libsite-packagespyinstaller-2.1.1.dev0-py2.7.eggPyInstallerloader\_pyi_bootstrap.py

    突然发现程序找的依赖DLL不是x86_microsoft.vc90.CRT  而是   x86_Microsoft.VC90.DebugCRT , 应该是debug调试模式运行

     网上找来找去也没有找到x86_Microsoft.VC90.DebugCRT.dll 的下载地址

     在看看Pyinstaller里面的参数说明:

    ----------------------------------------------------------------------------------------------------------

    -F, --onefile Py代码只有一个文件

    -D, --onedir Py代码放在一个目录中(默认是这个)

    -K, --tk 包含TCL/TK

    -d, --debug 生成debug模式的exe文件

    -w, --windowed, --noconsole 窗体exe文件(Windows Only)

    -c, --nowindowed, --console 控制台exe文件(Windows Only)

    -o DIR, --out=DIR 设置spec文件输出的目录,默认在PyInstaller同目录

    --icon=<FILE.ICO> 加入图标(Windows Only)

    -v FILE, --version=FILE 加入版本信息文件

    ----------------------------------------------------------------------------------------------------------

    我打包的时候是不带有-d参数的,所以不知道这里的debug是否为pyinstaller里面所指的debug, 我试着加上参数-d ,打包信息中还是出现:

    1 22894 ERROR: Assembly x86_Microsoft.VC90.DebugCRT_1fc8b3b9a1e18e3b_9.0.21022.8_none not found
    2 23014 INFO: Searching for assembly x86_Microsoft.VC90.DebugCRT_1fc8b3b9a1e18e3b_9.0.21022.8_none ...
    3 23014 WARNING: Assembly not found

    带与不带参数-d效果一样!

    没办法只能查看pyinstaller生成的文件吧,这一看还是没找到问题,但看到了解决办法

    在build目录里面有个.manifest文件

     1 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
     2 <assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
     3   <assemblyIdentity name="qrcode_a" processorArchitecture="x86" type="win32" version="1.0.0.0"/>
     4   <dependency>
     5     <dependentAssembly>
     6       <assemblyIdentity name="Microsoft.VC90.CRT" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b" type="win32" version="9.0.21022.8"/>
     7     </dependentAssembly>
     8   </dependency>
     9   <dependency>
    10     <dependentAssembly>
    11       <assemblyIdentity name="Microsoft.VC90.DebugCRT" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b" type="win32" version="9.0.21022.8"/>
    12     </dependentAssembly>
    13   </dependency>
    14   <dependency>
    15     <dependentAssembly>
    16       <assemblyIdentity language="*" name="Microsoft.Windows.Common-Controls" processorArchitecture="x86" publicKeyToken="6595b64144ccf1df" type="win32" version="6.0.0.0"/>
    17     </dependentAssembly>
    18   </dependency>
    19 </assembly>

    果然看到:Microsoft.VC90.DebugCRT

    解决办法:

    将.manifest文件中    Microsoft.VC90.DebugCRT      改为     Microsoft.VC90.CRT  

     

    在打包运行,一切OK!

     

    但为什么会出现debug模式,我还是没找到问题。

  • 相关阅读:
    案例十:shell编写nginx服务启动程序
    Linux在实际中的应用
    案例九:shell脚本自动创建多个新用户,并设置密码
    数据架构的演变
    第一个Struts2程序
    关于eclipse导入Tomact报404的问题
    单选框 RadioButton
    EditText编辑框
    Button控件的三种点击事件
    1319: 同构词
  • 原文地址:https://www.cnblogs.com/dcb3688/p/4245169.html
Copyright © 2020-2023  润新知