为什么不是pyinstaller使我成为一个.exe文件?

问题描述:

我正在试图按照this guide来制作一个简单的Hello World脚本到一个.exe文件中。为什么不是pyinstaller使我成为一个.exe文件?

我的Windows Vista与AMD 64位处理器
我已经安装了Python 2.6.5(视窗AMD64版)
我已经设置了PATH(如果这是正确的字),以便在命令行Python的识别
我已经安装了UPX(似乎只有Windows的32位版本),并按照指示将upx.exe的副本粘贴到Python26文件夹中。
我已经安装了Pywin(Windows AMD 64 Python 2.6版本)
我已经运行了Pyinstaller的Configure.py。它提供了一些错误消息,但似乎完成。我不知道这是什么导致了问题,所以下面是它说当我运行它:

C:\Python26\Pyinstaller\branches\py26win>Configure.py
I: read old config from C:\Python26\Pyinstaller\branches\py26win\config.dat
I: computing EXE_dependencies
I: Finding TCL/TK...
I: Analyzing C:\Python26\DLLs_tkinter.pyd
W: Cannot get binary dependencies for file:
W: C:\Python26\DLLs_tkinter.pyd
W: Traceback (most recent call last):
File "C:\Python26\Pyinstaller\branches\py26win\bindepend.py", line 608, in get Imports
return _getImports_pe(pth) File "C:\Python26\Pyinstaller\branches\py26win\bindepend.py", line 275, in _ge tImports_pe
importva, importsz = datadirs[1] IndexError: list index out of range

I: Analyzing C:\Python26\DLLs_ctypes.pyd
W: Cannot get binary dependencies for file:
W: C:\Python26\DLLs_ctypes.pyd
W: Traceback (most recent call last):
File "C:\Python26\Pyinstaller\branches\py26win\bindepend.py", line 608, in get Imports
return _getImports_pe(pth)
File "C:\Python26\Pyinstaller\branches\py26win\bindepend.py", line 275, in _ge tImports_pe
importva, importsz = datadirs[1]
IndexError: list index out of range

I: Analyzing C:\Python26\DLLs\select.pyd
W: Cannot get binary dependencies for file:
W: C:\Python26\DLLs\select.pyd
W: Traceback (most recent call last):
File "C:\Python26\Pyinstaller\branches\py26win\bindepend.py", line 608, in get Imports
return _getImports_pe(pth)
File "C:\Python26\Pyinstaller\branches\py26win\bindepend.py", line 275, in _ge tImports_pe
importva, importsz = datadirs[1]
IndexError: list index out of range

I: Analyzing C:\Python26\DLLs\unicodedata.pyd
W: Cannot get binary dependencies for file:
W: C:\Python26\DLLs\unicodedata.pyd
W: Traceback (most recent call last):
File "C:\Python26\Pyinstaller\branches\py26win\bindepend.py", line 608, in get Imports
return _getImports_pe(pth)
File "C:\Python26\Pyinstaller\branches\py26win\bindepend.py", line 275, in _ge tImports_pe
importva, importsz = datadirs[1]
IndexError: list index out of range

I: Analyzing C:\Python26\DLLs\bz2.pyd
W: Cannot get binary dependencies for file:
W: C:\Python26\DLLs\bz2.pyd
W: Traceback (most recent call last):
File "C:\Python26\Pyinstaller\branches\py26win\bindepend.py", line 608, in get Imports
return _getImports_pe(pth)
File "C:\Python26\Pyinstaller\branches\py26win\bindepend.py", line 275, in _ge tImports_pe
importva, importsz = datadirs[1]
IndexError: list index out of range

I: Analyzing C:\Python26\python.exe
I: Dependent assemblies of C:\Python26\python.exe:
I: amd64_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8_none
I: Searching for assembly amd64_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8_ none...
I: Found manifest C:\Windows\WinSxS\Manifests\amd64_microsoft.vc90.crt_1fc8b3b9a 1e18e3b_9.0.21022.8_none_750b37ff97f4f68b.manifest
I: Searching for file msvcr90.dll
I: Found file C:\Windows\WinSxS\amd64_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.21 022.8_none_750b37ff97f4f68b\msvcr90.dll
I: Searching for file msvcp90.dll
I: Found file C:\Windows\WinSxS\amd64_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.21 022.8_none_750b37ff97f4f68b\msvcp90.dll
I: Searching for file msvcm90.dll
I: Found file C:\Windows\WinSxS\amd64_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.21 022.8_none_750b37ff97f4f68b\msvcm90.dll
I: Adding Microsoft.VC90.CRT\Microsoft.VC90.CRT.manifest
I: Adding Microsoft.VC90.CRT\msvcr90.dll
I: Adding Microsoft.VC90.CRT\msvcp90.dll
I: Adding Microsoft.VC90.CRT\msvcm90.dll
W: Cannot get binary dependencies for file:
W: C:\Python26\python.exe
W: Traceback (most recent call last):
File "C:\Python26\Pyinstaller\branches\py26win\bindepend.py", line 608, in get Imports
return _getImports_pe(pth)
File "C:\Python26\Pyinstaller\branches\py26win\bindepend.py", line 275, in _ge tImports_pe
importva, importsz = datadirs[1]
IndexError: list index out of range

I: Analyzing C:\Windows\WinSxS\Manifests\amd64_microsoft.vc90.crt_1fc8b3b9a1e18e 3b_9.0.21022.8_none_750b37ff97f4f68b.manifest
I: Analyzing C:\Windows\WinSxS\amd64_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.210 22.8_none_750b37ff97f4f68b\msvcr90.dll
W: Cannot get binary dependencies for file:
W: C:\Windows\WinSxS\amd64_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.21022.8_none_ 750b37ff97f4f68b\msvcr90.dll
W: Traceback (most recent call last):
File "C:\Python26\Pyinstaller\branches\py26win\bindepend.py", line 608, in get Imports
return _getImports_pe(pth)
File "C:\Python26\Pyinstaller\branches\py26win\bindepend.py", line 275, in _ge tImports_pe
importva, importsz = datadirs[1]
IndexError: list index out of range

I: Analyzing C:\Windows\WinSxS\amd64_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.210 22.8_none_750b37ff97f4f68b\msvcp90.dll
W: Cannot get binary dependencies for file:
W: C:\Windows\WinSxS\amd64_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.21022.8_none_ 750b37ff97f4f68b\msvcp90.dll
W: Traceback (most recent call last):
File "C:\Python26\Pyinstaller\branches\py26win\bindepend.py", line 608, in get Imports
return _getImports_pe(pth)
File "C:\Python26\Pyinstaller\branches\py26win\bindepend.py", line 275, in _ge tImports_pe
importva, importsz = datadirs[1]
IndexError: list index out of range

I: Analyzing C:\Windows\WinSxS\amd64_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.210 22.8_none_750b37ff97f4f68b\msvcm90.dll
W: Cannot get binary dependencies for file:
W: C:\Windows\WinSxS\amd64_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.21022.8_none_ 750b37ff97f4f68b\msvcm90.dll
W: Traceback (most recent call last):
File "C:\Python26\Pyinstaller\branches\py26win\bindepend.py", line 608, in get Imports
return _getImports_pe(pth)
File "C:\Python26\Pyinstaller\branches\py26win\bindepend.py", line 275, in _ge tImports_pe
importva, importsz = datadirs[1]
IndexError: list index out of range

I: could not find TCL/TK
I: testing for Zlib...
I: ... Zlib available
I: Testing for ability to set icons, version resources...
I: ... resource update available
I: Testing for Unicode support...
I: ... Unicode available
I: testing for UPX...
I: ...UPX available
I: computing PYZ dependencies...
I: done generating C:\Python26\Pyinstaller\branches\py26win\config.dat

我的Python脚本(名为Hello.py)是一样的例子:

#!/usr/bin/env python 
for i in xrange(10000): 
print "Hello, World!" 

这是我的BAT文件,在同一目录:

set PIP=C:\Python26\Pyinstaller\branches\py26win\
python %PIP%Makespec.py --onefile --console --upx --tk Hello.py
python %PIP%Build.py Hello.spec

当我在运行命令提示符Hello.bat几个文件是由,其中没有一个是.exe文件,以及以下显示为:

C:\My Files>set PIP=C:\Python26\Pyinstaller\branches\py26win\

C:\My Files>python C:\Python26\Pyinstaller\branches\py26win\Makespec.py --onefil e --console --upx --tk Hello.py wrote C:\My Files\Hello.spec now run Build.py to build the executable

C:\My Files>python C:\Python26\Pyinstaller\branches\py26win\Build.py Hello.spec

I: Dependent assemblies of C:\Python26\python.exe: I: amd64_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8_none Traceback (most recent call last): File "C:\Python26\Pyinstaller\branches\py26win\Build.py", line 1359, in main(args[0], configfilename=opts.configfile)
File "C:\Python26\Pyinstaller\branches\py26win\Build.py", line 1337, in main build(specfile)
File "C:\Python26\Pyinstaller\branches\py26win\Build.py", line 1297, in build execfile(spec)
File "Hello.spec", line 3, in
pathex=['C:\My Files'])
File "C:\Python26\Pyinstaller\branches\py26win\Build.py", line 292, in __init_ _
raise ValueError, "script '%s' not found" % script
ValueError: script 'C:\Python26\Pyinstaller\branches\py26win\support\useTK.py' n ot found

我有限的知识,在命令提示符下,所以,请带我的宝宝步骤,如果我需要做的事情还有。

在Windows下,pyinstaller不支持64位Python。但是,在64位环境下使用32位Python通常没有缺点,所以最简单的选择是安装和使用它。它还具有额外的好处,即由pyinstaller生成的可执行文件可以在32位和64位Windows下运行。

+5

对于几年后发现这个问题的人来说,PyInstaller不久前修复了这个问题。参见[bug#25](http://www.pyinstaller.org/ticket/25)。 – David 2014-03-11 16:16:22