为什么pyinstaller不给我生成一个.exe文件?

2024-10-01 15:39:32 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图按照this guide将一个简单的Hello World脚本制作成一个.exe文件。在

我有带AMD 64位处理器的Windows Vista
我已经安装了Python2.6.5(Windows AMD64版本)
我已经设置了路径(如果是正确的话),以便命令行识别Python
我已经安装了UPX(似乎只有32位版本的Windows)并粘贴了upx.exe文件按照说明放入Python26文件夹。
我已经安装了Pywin(Windows AMD 64 Python 2.6版本)
我运行过Pyinstaller的配置.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脚本(名为你好.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

当我跑的时候你好,蝙蝠在命令提示符下生成多个文件,其中没有一个是.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

我对命令提示符的知识有限,所以如果我需要在那里做些什么,请跟我一起迈出第一步。在


Tags: inpyforgetwindowslinefiledll
1条回答
网友
1楼 · 发布于 2024-10-01 15:39:32

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

相关问题 更多 >

    热门问题