python打包成exe,执行exe文件出错
背景:最近在学python爬虫,写了一个最简单的爬一个网址的一点信息,想做成exe给别人用。
过程:
1、在windows x64环境下用pyinstaller打包了一个exe,使用正常,但是不能在32位的环境下运行,所以打算开个32位的windows虚拟机来打包一个32位的exe;
2、准备好一切环境后使用pyinstaller来打包,过程中没出现过任何错误,只打包单个py文件,在打包前运行过py文件,正常使用,相关的库都导入了。
打包命令:
E:\PyInstaller-3.0>python pyinstaller.py -w --onefile --icon="Spider.ico" GetSS.
py
生成exe文件之后运行(就是在打包的虚拟机上运行):
附上打包过程信息:
E:\PyInstaller-3.0>python pyinstaller.py -w --onefile --icon="Spider.ico" GetSS.py
78 INFO: PyInstaller: 3.0
78 INFO: Python: 2.7.9
78 INFO: Platform: Windows-7-6.1.7601-SP1
78 INFO: wrote E:\PyInstaller-3.0\GetSS\GetSS.spec
78 INFO: UPX is not available.
78 INFO: Extending PYTHONPATH with E:\PyInstaller-3.0
78 INFO: checking Analysis
78 INFO: Building Analysis because out00-Analysis.toc is non existent
78 INFO: Initializing module dependency graph...
92 INFO: Initializing module graph hooks...
139 INFO: running Analysis out00-Analysis.toc
139 INFO: Adding Microsoft.VC90.CRT to dependent assemblies of final executable
required by C:\Python27\python.exe
171 INFO: Found C:\Windows\WinSxS\Manifests\x86_policy.9.0.microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4148_none_f47e1bd6f6571810.manifest
171 INFO: Found C:\Windows\WinSxS\Manifests\x86_policy.9.0.microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4940_none_f47ed0f6f6564d90.manifest
171 INFO: Found C:\Windows\WinSxS\Manifests\x86_policy.9.0.microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161_none_f480bfaef65491a5.manifest
217 INFO: Searching for assembly x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.30729.6161_none ...
217 INFO: Found manifest C:\Windows\WinSxS\Manifests\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161_none_50934f2ebcb7eb57.manifest
217 INFO: Searching for file msvcr90.dll
217 INFO: Found file C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161_none_50934f2ebcb7eb57\msvcr90.dll
217 INFO: Searching for file msvcp90.dll
217 INFO: Found file C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161_none_50934f2ebcb7eb57\msvcp90.dll
217 INFO: Searching for file msvcm90.dll
217 INFO: Found file C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161_none_50934f2ebcb7eb57\msvcm90.dll
249 INFO: Found C:\Windows\WinSxS\Manifests\x86_policy.9.0.microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4148_none_f47e1bd6f6571810.manifest
264 INFO: Found C:\Windows\WinSxS\Manifests\x86_policy.9.0.microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4940_none_f47ed0f6f6564d90.manifest
264 INFO: Found C:\Windows\WinSxS\Manifests\x86_policy.9.0.microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161_none_f480bfaef65491a5.manifest
264 INFO: Adding redirect Microsoft.VC90.CRT version (9, 0, 21022, 8) -> (9, 0,30729, 6161)
435 INFO: Analyzing E:\PyInstaller-3.0\GetSS.py
4148 INFO: Looking for import hooks ...
4164 INFO: Processing hook hook-xml.py
4211 INFO: Processing hook hook-httplib.py
4226 INFO: Processing hook hook-encodings.py
4680 INFO: Processing hook hook-_tkinter.py
4805 INFO: checking Tree
4805 INFO: Building Tree because out00-Tree.toc is non existent
4819 INFO: Building Tree out00-Tree.toc
4976 INFO: checking Tree
4976 INFO: Building Tree because out01-Tree.toc is non existent
4976 INFO: Building Tree out01-Tree.toc
4991 INFO: Processing hook hook-requests.py
5006 INFO: Processing hook hook-xml.sax.py
5023 INFO: Looking for ctypes DLLs
5039 INFO: Analyzing run-time hooks ...
5039 INFO: Including run-time hook 'pyi_rth__tkinter.py'
5053 INFO: Looking for dynamic libraries
5724 INFO: Looking for eggs
5724 INFO: Using Python library C:\Windows\system32\python27.dll
5724 INFO: Found binding redirects:[BindingRedirect(name=u'Microsoft.VC90.CRT', language=None, arch=u'x86', oldVersion=(9, 0, 21022, 8), newVersion=(9, 0, 30729, 6161), publicKeyToken=u'1fc8b3b9a1e18e3b')]
5772 INFO: Warnings written to E:\PyInstaller-3.0\GetSS\build\GetSS\warnGetSS.txt
5772 INFO: checking PYZ
5786 INFO: Building PYZ because out00-PYZ.toc is non existent
5786 INFO: Building PYZ (ZlibArchive) E:\PyInstaller-3.0\GetSS\build\GetSS\out00-PYZ.pyz
6068 INFO: checking PKG
6068 INFO: Building PKG because out00-PKG.toc is non existent
6068 INFO: Building PKG (CArchive) out00-PKG.pkg
6161 INFO: Redirecting Microsoft.VC90.CRT version (9, 0, 21022, 8) -> (9, 0, 30729, 6161)
7924 INFO: Bootloader E:\PyInstaller-3.0\PyInstaller\bootloader\Windows-32bit\runw.exe
7924 INFO: checking EXE
7924 INFO: Building EXE because out00-EXE.toc is non existent
7924 INFO: Building EXE from out00-EXE.toc
7924 INFO: SRCPATH [('Spider.ico', None)]
7940 INFO: Updating icons from ['Spider.ico'] to c:\users\zh_vm\appdata\local\temp\tmpnjymmo
7940 INFO: Writing RT_GROUP_ICON 0 resource with 20 bytes
7940 INFO: Writing RT_ICON 1 resource with 67624 bytes
7940 INFO: Appending archive to EXE E:\PyInstaller-3.0\GetSS\dist\GetSS.exe
E:\PyInstaller-3.0>
3、再打包一次带命令窗口模式的,运行之后就一闪而过了,没有返回信息
求各位帮帮忙看看是什么问题
PS:所有相关目录名称都是英文命名
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
pyinstaller就是各种bug,但是很方便,真是让人欲罢不能
试试py2exe,稍微麻烦些,但是很稳定的