Python3.4 Py2exe,错误 - 名称'WinDLL'未定义

时间:2014-09-18 13:06:16

标签: python py2exe

我使用Ubuntu,Python 3.4并尝试使用py2exe将我的py脚本编译为exe。

不幸的是,当我尝试使用命令'build_exe'时,它会生成错误! 有人可以帮我解决它或建议如何以另一种方式将py项目编译为exe吗?

错误代码:

NameError: name 'WinDLL' is not define

enter image description here

2 个答案:

答案 0 :(得分:2)

py2exe适用于Windows ...

在Linux上,您可以尝试 PyInstaller
http://www.pyinstaller.org/

  

PyInstaller现在能够在运行时构建Windows可执行文件   在Linux下。有关详细信息,请参阅文档。

答案 1 :(得分:0)

py2exe 模块需要从命令提示符外壳(也称为Windows终端)中运行,以使Windows可执行文件,因为就像 pyinstaller ,“ they use the OS support to load the dynamic libraries, thus ensuring full compatibility”。这就是为什么在bash shell中使用 py2exe 模块时会出现“未定义WinDLL”错误的原因。

py2exe 可以使用到python-3.4,而 pyinstaller 可以使用到python-3.7。撰写本文时的最新版本是3.8。在命令提示符下使用python模块 virtualenv 来运行adeqaute python版本(无需替换当前的python设置),并制作可执行文件。 Here is my answer with code。 ->确保在安装时将python添加到Windows路径中,以便可以在命令提示符下使用 pip python 命令。否则,您必须在我的答案中替换这些命令以获取其完整路径,例如C:\ Users \ jakethefinn \ python37 \ pip.exe和C:\ Users \ jakethefinn \ python37 \ python.exe。 如果从Microsoft Store安装python,则文件pip.exe和python.exe会自动添加到路径中。