您的位置:首页 > 编程语言 > Python开发

python脚本转化单个exe执行程序

2013-05-20 21:23 429 查看
操作系统平台:
Windows Server 2003 R2 Enterprise SP2 X86简体中文版

1.ActivePython-2.7.5.6-win32-x86.msi

2.setuptools-1.4.1
python setup.py install

3.distribute-0.6.49(兼容性考虑,建议不要使用0.7.3)
python setup.py install

4.pywin32-217.win32-py2.7.exe

5.PyInstaller-2.1.zip

python setup.py install

6.vcredist_x86.exe(Microsoft Visual C++ 2008 Redistributable Package (x86))

vcredist_x86_2008.exe(1,718KB)

7.复制要生成exe的程序processlist.py到C:\Python27\Scripts

8.C:\Python27\Scripts目录命令行执行
C:\Python27\Scripts>pyinstaller.exe -F processlist.py
31 INFO: wrote C:\Python27\Scripts\processlist.spec
62 INFO: Testing for ability to set icons, version resources...
78 INFO: ... resource update available
78 INFO: UPX is not available.
108 INFO: Processing hook hook-os
344 INFO: Processing hook hook-time
344 INFO: Processing hook hook-cPickle
483 INFO: Processing hook hook-_sre
733 INFO: Processing hook hook-cStringIO
921 INFO: Processing hook hook-encodings
953 INFO: Processing hook hook-codecs
1656 INFO: Extending PYTHONPATH with C:\Python27\Scripts
1656 INFO: checking Analysis
1656 INFO: building Analysis because out00-Analysis.toc non existent
1656 INFO: running Analysis out00-Analysis.toc
1656 INFO: Adding Microsoft.VC90.CRT to dependent assemblies of final executable

1671 INFO: Searching for assembly x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21
022.8_x-ww ...
1671 INFO: Found manifest C:\WINDOWS\WinSxS\Manifests\x86_Microsoft.VC90.CRT_1fc
8b3b9a1e18e3b_9.0.21022.8_x-ww_d08d0375.manifest
1671 INFO: Searching for file msvcr90.dll
1671 INFO: Found file C:\WINDOWS\WinSxS\x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_
9.0.21022.8_x-ww_d08d0375\msvcr90.dll
1671 INFO: Searching for file msvcp90.dll
1671 INFO: Found file C:\WINDOWS\WinSxS\x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_
9.0.21022.8_x-ww_d08d0375\msvcp90.dll
1671 INFO: Searching for file msvcm90.dll
1671 INFO: Found file C:\WINDOWS\WinSxS\x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_
9.0.21022.8_x-ww_d08d0375\msvcm90.dll
1858 INFO: Analyzing C:\Python27\lib\site-packages\pyinstaller-2.1-py2.7.egg\PyI
nstaller\loader\_pyi_bootstrap.py
1891 INFO: Processing hook hook-os
1921 INFO: Processing hook hook-site
1953 INFO: Processing hook hook-encodings
2171 INFO: Processing hook hook-time
2187 INFO: Processing hook hook-cPickle
2296 INFO: Processing hook hook-_sre
2483 INFO: Processing hook hook-cStringIO
2641 INFO: Processing hook hook-codecs
3266 INFO: Processing hook hook-pydoc
3516 INFO: Processing hook hook-email
3656 INFO: Processing hook hook-httplib
3703 INFO: Processing hook hook-email.message
3796 INFO: Analyzing C:\Python27\lib\site-packages\pyinstaller-2.1-py2.7.egg\PyI
nstaller\loader\pyi_importers.py
3875 INFO: Analyzing C:\Python27\lib\site-packages\pyinstaller-2.1-py2.7.egg\PyI
nstaller\loader\pyi_archive.py
3937 INFO: Analyzing C:\Python27\lib\site-packages\pyinstaller-2.1-py2.7.egg\PyI
nstaller\loader\pyi_carchive.py
4000 INFO: Analyzing C:\Python27\lib\site-packages\pyinstaller-2.1-py2.7.egg\PyI
nstaller\loader\pyi_os_path.py
4016 INFO: Analyzing processlist.py
4233 INFO: Hidden import 'codecs' has been found otherwise
4233 INFO: Hidden import 'encodings' has been found otherwise
4233 INFO: Looking for run-time hooks
4656 INFO: Using Python library C:\WINDOWS\system32\python27.dll
4733 INFO: Warnings written to C:\Python27\Scripts\build\processlist\warnprocess
list.txt
4733 INFO: checking PYZ
4750 INFO: rebuilding out00-PYZ.toc because out00-PYZ.pyz is missing
4750 INFO: building PYZ (ZlibArchive) out00-PYZ.toc
6483 INFO: checking PKG
6483 INFO: rebuilding out00-PKG.toc because out00-PKG.pkg is missing
6483 INFO: building PKG (CArchive) out00-PKG.pkg
8531 INFO: checking EXE
8531 INFO: rebuilding out00-EXE.toc because processlist.exe missing
8531 INFO: building EXE from out00-EXE.toc
8531 INFO: Appending archive to EXE C:\Python27\Scripts\dist\processlist.exe

C:\Python27\Scripts>

9.复制C:\Python27\Scripts\dist目录下processlist.exe到未安装python的服务器上

问题解决:

错误提示:
无法发现 msvcr90.dll (9.0.21022.8 版本号)
解决办法:
需安装Microsoft Visual C++ 2008 Redistributable Package (x86)
下载网址: http://www.microsoft.com/zh-CN/download/details.aspx?id=29
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  exe Python