码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2015-01-23 22:57:27      阅读:1026      评论:0      收藏:0      [点我收藏+]

标签:

做了一个生成二维码的小程序: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:\Python27\lib\site-packages\pyinstaller-2.1.1.dev0-py2.7.egg\PyInstaller\loader\rthooks\pyi_rth_qt4plugins.py
3 19845 INFO: Analyzing rthook C:\Python27\lib\site-packages\pyinstaller-2.1.1.dev0-py2.7.egg\PyInstaller\loader\rthooks\pyi_rth_PIL_Image.py
4 19954 INFO: Analyzing rthook C:\Python27\lib\site-packages\pyinstaller-2.1.1.dev0-py2.7.egg\PyInstaller\loader\rthooks\pyi_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:\www\pyqt\TEST\qrcode_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:\www\pyqt\TEST
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:\Windows\WinSxS\Manifests\x86_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:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.21022.8_none_bcb86ed6ac711f91\msvcr90.dll
21 11510 INFO: Searching for file msvcp90.dll
22 11511 INFO: Found file C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.21022.8_none_bcb86ed6ac711f91\msvcp90.dll
23 11513 INFO: Searching for file msvcm90.dll
24 11513 INFO: Found file C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.21022.8_none_bcb86ed6ac711f91\msvcm90.dll
25 11827 INFO: Analyzing C:\Python27\lib\site-packages\pyinstaller-2.1.1.dev0-py2.7.egg\PyInstaller\loader\_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模式,我还是没找到问题。

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

标签:

原文地址:http://www.cnblogs.com/dcb3688/p/4245169.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!