天天看點

python腳本轉化單個exe執行程式

作業系統平台:

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)

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

5.PyInstaller-2.1.zip

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

9.0.21022.8_x-ww_d08d0375\msvcp90.dll

1671 INFO: Searching for file msvcm90.dll

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

本文轉自 pgmia 51CTO部落格,原文連結:http://blog.51cto.com/heyiyi/1205130