我目前在Windows机器上使用Python 2.7 + wxPython 2.8.11。在尝试构建一个小项目(也使用comtypes并允许说任何activex,如flashwindow)时,我收到以下错误:
>>>"c:\Program Files\Python_2.7\python.exe" setup.py py2exe
running py2exe
*** searching for required modules ***
*** parsing results ***
*** finding dlls needed ***
error: MSVCP90.dll: No such file or directory
我通过将.dll和.manifest文件复制到目录来修复它。它建立得很好。 但在执行时我又得到了错误 'CreateActCtx'失败,错误0x0000007b
File "zipextimporter.pyo", line 82, in load_module
File "wx\lib\flashwin.pyo", line 15, in
File "zipextimporter.pyo", line 82, in load_module
File "wx\lib\activex.pyo", line 44, in <module>
ImportError: cannot import name myole4ax
所以,我将我的wxPython升级到2.9 *(Python 2.7),失败了,无法找到PROCESS_START。所以,我不得不恢复到2.8.11(使用Python 2.7)现在,它失败了以下(在将MSVC * 90.dll复制到本地目录并构建成单个可执行文件之后):
C:\testflv> testflv.exe
Traceback (most recent call last):
File "testflv.py", line 10, in <module>
File "zipextimporter.pyo", line 82, in load_module
File "wx\__init__.pyo", line 45, in <module>
File "zipextimporter.pyo", line 82, in load_module
File "wx\_core.pyo", line 4, in <module>
File "zipextimporter.pyo", line 98, in load_module
ImportError: MemoryLoadLibrary failed loading wx\_core_.pyd
似乎这里提到的myole4ax *存在问题(http://comments.gmane.org/gmane.comp.python.wxpython.devel/3114):
> Looks like the installer on windows does not include
> wx/lib/myole4ax.tlb and the brand new comtypes based ActiveX stuff
> does not work.
> After getting the missing stuff from SVN import errors go away.
Oops. Sorry about that. For the record here is the link to get the file.
http://trac.wxwidgets.org/browser/wxPython/branches/WX_2_8_BRANCH/wx/lib/myole4ax.tlb
如何解决问题或是否需要切换回旧版本?我被卡住了。在这方面的任何帮助将受到高度赞赏。
感谢。
答案 0 :(得分:0)
我也尝试过旧版本,但没有多大帮助,但它帮助我清楚了解情况。在尝试捆绑可执行文件中的内容时,我收到了此警告/错误/消息:
*** copy extensions ***
*** copy dlls ***
copying C:\Program Files\Python_2.6.5\w9xpopen.exe -> c:\wxpython\test\dist
copying C:\Program Files\Python_2.6.5\lib\site-packages\py2exe\run.exe -> c:\wxpython\test\dist\testactivex.exe
Adding python26.dll as resource to c:\wxpython\test\dist\testactivex.exe
The following modules appear to be missing
['comtypes.gen']
所以,这就是为什么当我们执行可执行文件时失败并出现以下错误:
c:\wxpython\test\dist>testactivex.exe
10:13:16: Debug: src/helpers.cpp(140): 'CreateActCtx' failed with error 0x0000007b (the filename, directory name, or volume label syntax is incorrect.).
Traceback (most recent call last):
File "testactivex.py", line 24, in <module>
ImportError: cannot import name myole4ax
但是当我们执行
时python.exe testactivex.py
工作正常。我试图深入研究它,我发现了一些有趣的链接如下:
http://markmail.org/message/btbsrqhvfvyclfgo#query:+page:1+mid:btbsrqhvfvyclfgo+state:results
虽然我对这个问题有所了解,但我无法找到解决myole4ax和comtypes.gen问题的方法。如果你们中的任何人知道怎么用这个包装或创建exe而没有任何问题,请告诉我。
ImportError: cannot import name myole4ax
myole4ax和comtypes.gen问题是因为它没有足够的权限。在管理员模式下从命令行编译,问题得到解决。
非常感谢!