任何Python“编译器”可以静态链接 python2x.dll 依赖项吗?
据我了解,py2exe只能动态链接python2x.dll文件。是否有任何 Python“编译器”可以将其全部打包到一个独立的 .exe 文件中,以便于移植?
如果是或不是,哪个是最好的编译器 z0mg!
It's my understanding that py2exe can only dynamically link a python2x.dll file. Are there any Python "compilers" out there that can package it all into one standalone .exe file for easier portability?
If so or if not, which is the best compiler z0mg!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果您检查 py2exe SingleFileExecutable wiki 页面 的底部,您会发现它可以创建单文件可执行文件。它们确实包含 DLL,但您不应该注意到这一点。我相信它与一个奇怪的黑客一起工作,该黑客拦截 LoadLibrary 调用以允许它们从 .exe 文件中的其他位置读取,但同样您不应该注意到这一点。我们以前用过它......它有效。
If you check the bottom of the py2exe SingleFileExecutable wiki page you'll see that it can create one-file executables. They do include the DLL inside, but you shouldn't notice that. I believe it works with a freakish hack that intercepts the LoadLibrary calls to allow them to read from elsewhere in the .exe file, but again you shouldn't notice that. We've used it before... it works.
PyInstaller 声称能够创建用户友好的单一可执行文件。也许这会满足您的需求。我从来没有用过它。
PyInstaller claims to be able to create a single-executable that's user-friendly. Perhaps that would meet your needs. I've never used it.
py2exe 可以将其全部打包在单个可执行文件中,无需在目标系统上安装任何 python,它可能包含 python2x.dll,但对于最终用户来说这有什么关系
py2exe can package it all in single executable, without needing any python installation on target system, it may include python2x.dll with it, but for the end user how does it matter
据我了解,可以将 python 静态链接到可执行文件中,但随后您将失去加载其他动态模块(.pyd 文件)的能力,例如 os 和 zlib和数学。除非您能够将它们静态编译到您的主程序中。
据我所知,唯一可以做到这一点的编译器是从源代码编译 python 的 C 编译器。 :)
我不确定它是否值得付出努力。
最好只使用 p2exe 并创建一个可以压缩和发送的文件目录。
From what I understand, it is possible to statically link python into an executable, but then you lose your ability to load other dynamic modules (.pyd files) like
os
andzlib
andmath
. Unless you are able to statically compile those as well into your main program.And as far as I know, the only compiler that can do this is the C compiler that is compiling python from source. :)
I'm not sure its worth the effort at all.
Better just use p2exe and create a directory of files that can be zipped and shipped.