简体   繁体   English

使用py2exe捆绑PyQwt

[英]Bundling PyQwt with py2exe

I have a standard setup script for py2exe with which I bundle PyQt-based applications into Windows .exe files. 我有一个用于py2exe的标准安装脚本,该脚本将基于PyQt的应用程序捆绑到Windows .exe文件中。

Today I tried a simple script that uses the PyQwt module, and it doesn't seem to work. 今天,我尝试了一个使用PyQwt模块的简单脚本,但它似乎不起作用。 py2exe runs alright, but when I execute the .exe it creates, it dumps the following into a log file and doesn't run: py2exe可以正常运行,但是当我执行它创建的.exe时,它将以下内容转储到日志文件中并且无法运行:

Traceback (most recent call last):
  File "qwt_test.pyw", line 5, in <module>
  File "zipextimporter.pyo", line 82, in load_module
  File "PyQt4\Qwt5\__init__.pyo", line 32, in <module>
  File "zipextimporter.pyo", line 98, in load_module
ImportError: MemoryLoadLibrary failed loading PyQt4\Qwt5\Qwt.pyd

When I look in PyQt4\\Qwt5\\ in the build\\bdist.win32\\winexe\\collect-2.5 directory, Qwt.pyd is definitely there. 当我查看build\\bdist.win32\\winexe\\collect-2.5目录中的PyQt4\\Qwt5\\时,肯定存在Qwt.pyd

I can't seem to find anything useful online regarding this error. 我似乎找不到关于此错误的任何有用的在线信息。 What could cause it? 是什么原因造成的? Thanks. 谢谢。

py2exe is not the only way, and maybe not the best way, to put together exe files for Python apps -- in particular, it hardly if at all supports pyqt. py2exe并不是将Python文件的exe文件放在一起的唯一方法,也许不是最好的方法-特别是,几乎完全不支持pyqt。 Please, I beseech you, check out PyInstaller , which DOES know about PyQt (and Linux, and Mac, should you care...) -- just make sure you use the SVN head checkout, not the "released" version, which at this time is seriously out of date (an issue that's hopefully going away soon...). 请,我请您检查一下PyInstaller ,它确实了解PyQt(以及Linux和Mac,请注意...)-请确保您使用的是SVN head checkout,而不是“ released”版本,这次已经严重过时了(希望这个问题很快消失……)。

Some options: 一些选项:

  1. Try playing with the py2xe bundle_files options (3, 2, 1) (especially if you put them all in one big library zip, some dlls don't like that). 尝试使用py2xe bundle_files optionsbundle_files options )(尤其是如果将它们全部放在一个大库zip中,则有些dll会不喜欢这样)。
  2. Make sure a copy of msvcp71.dll exists under windows\\system32 or in the directory of your executable. 确保msvcp71.dll的副本存在于Windows \\ system32下或可执行文件的目录中。
  3. Try excluding the dll explicitely (add Qwt.pyd to the dll_excludes option and (after building) copy Qwt.pyd (and _Qwt.pyd if it exists) to your executable path. 尝试显式排除dll(将Qwt.pyd添加到dll_excludes选项,并(在构建之后)将Qwt.pyd(和_Qwt.pyd如果存在)复制到您的可执行路径。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM