3
该应用程序是我开发的Win8环境下工作正常,但是当它被打包与py2exe和生产机器上运行它抛出异常:如何用py2exe打包psutil?
“程序输入点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']}}
但它不工作。有任何想法吗?提前致谢!
我试图自己解决完全相同的问题,所以我不能给你一个答案,但我相信py2exe给出的消息,“以下模块似乎缺少,”可能与问题有关。下面列出的许多东西都属于psutil。缺少的模块是_psutil_bsd,_psutil_linux,_psutil_osx,_psutil_posix和_psutil_sunos。奇怪的是,缺少_psutil_mswindows不在那里。 –
顺便说一句dll文件应该使用setup中的“resource_files”选项进行打包,“includes”选项仅适用于由于某些原因未能包含的python模块。 –
@ someone-or-other,感谢您的建议,我已通过将几个dll添加到排除列表中解决了此问题。这些是py2exe_options = {“py2exe”:{“includes”:['decimal','_mssql','uuid'], “dll_excludes”:[“mswsock.dll”, “powrprof.dll”, “user32 .DLL “ ”SHELL32.DLL“, ”的wsock32.dll“, ”ADVAPI32.DLL“, ”KERNEL32.DLL“, ”ntwdblib.dll“, ”ws2_32.dll的“, ” OLEAUT32。 dll“, ”ole32.dll“], }} – Erxin