3

该应用程序在我的开发 win8 环境中运行良好,但是当它与 py2exe 打包并在生产机器上运行时,它会抛出异常:

“程序入口点 RtlIdnToAscii 无法位于动态链接库 ntdll.dll 中”

日志文件的详细内容是

Traceback (most recent call last):
  File "DataviewerBackupRestorer.py", line 6, in <module>
  File "RestorController.pyc", line 7, in <module>
  File "psutil\__init__.pyc", line 136, in <module>
  File "psutil\_psmswindows.pyc", line 14, in <module>
  File "_psutil_mswindows.pyc", line 12, in <module>
  File "_psutil_mswindows.pyc", line 10, in __load
ImportError: DLL load failed: The specified procedure could not be found.

打包过程中似乎缺少psutil所需的dll 。我试图添加 py2exe 选项

py2exe_options = {"py2exe":{"includes":['decimal', '_mssql', 'uuid', 'psutil', '_psutil_mswindows']}}

但它不起作用。有任何想法吗?提前致谢!

4

1 回答 1

3

解决方案是从项目目录中删除系统 DLL。当我将 psutil 添加到我的应用程序 py2exe 时,我的项目中添加了很多系统 DLL。它在我和其他一些计算机上正常工作,但在另一台计算机上却失败了。从项目中删除 C:\Windows\System32 中可用的 .dll 文件解决了该问题。

最后在我的情况下,解决方案是添加:

            'dll_excludes': [ "IPHLPAPI.DLL", "NSI.dll",  "WINNSI.DLL",  "WTSAPI32.dll"]

进入 setup.py 文件中的 py2exe 选项。

于 2014-01-31T14:55:39.660 回答