如何构建 py2exe 而不会出现错误?

2024-03-16

我通常不是 Windows 用户,但我需要从 python 代码构建 exe,所以我想使用 py2exe 来执行此操作。我有一个XP系统,我安装了python 2.6.6。我下载了 py2exe-0.6.9 源代码,但是当我尝试安装(通过“python setup.py install”)时,出现错误“无法找到 vcvarsall.bat”。我用谷歌搜索并发现了这个帖子 https://stackoverflow.com/questions/3691188/pygame-installation-on-windows-error-unable-to-find-vcvarsall-bat受访者建议安装可用的 MinGW GCC 二进制文件的自定义版本here http://www.develer.com/oss/GccWinBinaries。我这样做了,现在当我尝试安装 py2exe 时,我收到一个新错误。这是输出:

C:\Documents and Settings\Administrator\Desktop\py2exe-0.6.9>python setup.py install
C:\Documents and Settings\Administrator\Desktop\py2exe-0.6.9\py2exe\build_exe.py:16: DeprecationWarning: the sets module is deprecated
  import sets
running install
running build
running build_py
running build_ext
building '_memimporter' extension
creating build\temp.win32-2.6
creating build\temp.win32-2.6\Release
creating build\temp.win32-2.6\Release\source
c:\mingw\bin\gcc.exe -mno-cygwin -mdll -O -Wall -DPYTHONDLL=\"PYTHON26.DLL\" -DPYTHONCOM=\"pythoncom26.dll\" -IC:\Python26\include -IC:\Python26\PC -c source/MemoryModule.c -o build\temp.win32-2.6\Release\source\memorymodule.o
source/MemoryModule.c:30: warning: ignoring #pragma warning
source/MemoryModule.c: In function 'BuildImportTable':
source/MemoryModule.c:364: warning: pointer targets in passing argument 1 of 'MyLoadLibrary' differ in signedness
source/MemoryModule.c: In function 'GetNameTable':
source/MemoryModule.c:610: warning: passing argument 4 of 'qsort' from incompatible pointer type
source/MemoryModule.c: In function 'MemoryGetProcAddress':
source/MemoryModule.c:637: warning: passing argument 5 of 'bsearch' from incompatible pointer type
c:\mingw\bin\gcc.exe -mno-cygwin -mdll -O -Wall -DPYTHONDLL=\"PYTHON26.DLL\" -DPYTHONCOM=\"pythoncom26.dll\" -IC:\Python26\include -IC:\Python26\PC -c source/_memimporter_module.c -o build\temp.win32-2.6\Release\source\_memimporter_module.o

In file included from source/_memimporter.c:8,
                 from source/_memimporter_module.c:2:
source/Python-version.h:13: error: redefinition of typedef 'Py_ssize_t'
C:\Python26\include/pyport.h:115: error: previous declaration of 'Py_ssize_t' was here
error: command 'gcc' failed with exit status 1

http://bugs.python.org/issue1485576 http://bugs.python.org/issue1485576可能是一个错误,您可能想要重新打开,提供您的测试用例来支持它。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何构建 py2exe 而不会出现错误? 的相关文章

随机推荐