Python 2.7 + wxPython 2.8.11的问题?我应该切换回Python 2.6.5 + wx.Python 2.8.10.1吗?

时间:2010-11-17 20:29:24

标签: python wxpython py2exe comtypes

我目前在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

如何解决问题或是否需要切换回旧版本?我被卡住了。在这方面的任何帮助将受到高度赞赏。

感谢。

1 个答案:

答案 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

工作正常。我试图深入研究它,我发现了一些有趣的链接如下:

  1. http://markmail.org/message/btbsrqhvfvyclfgo#query:+page:1+mid:btbsrqhvfvyclfgo+state:results

  2. http://translate.google.com/translate?hl=en&sl=ja&u=http://blog.loadlimits.info/2010/01/py2exewxpython%25E3%2581%25A7myole4ax%25E3%2581%258C%25E8%25A6%258B%25E3%2581%25A4%25E3%2581%258B%25E3%2582%2589%25E3%2581%25AA%25E3%2581%2584%25E3%2581%25A8%25E8%25A8%2580%25E3%2582%258F%25E3%2582%258C%25E3%2582%258B%25E5%2595%258F%25E9%25A1%258C/&ei=T3DlTNmwNIeqsAOe_JWxCw&sa=X&oi=translate&ct=result&resnum=6&ved=0CDUQ7gEwBQ&prev=/search%3Fq%3DImportError:%2Bcannot%2Bimport%2Bname%2Bmyole4ax%26hl%3Den%26rlz%3D1R2ADRA_enUS387%26prmd%3Div


  3. 虽然我对这个问题有所了解,但我无法找到解决myole4ax和comtypes.gen问题的方法。如果你们中的任何人知道怎么用这个包装或创建exe而没有任何问题,请告诉我。

    ImportError: cannot import name myole4ax 
    

    myole4ax和comtypes.gen问题是因为它没有足够的权限。在管理员模式下从命令行编译,问题得到解决。

    非常感谢!