【发布时间】:2014-11-13 10:53:10
【问题描述】:
我在 Windows 7 上使用 Python 3.4。我的安装文件如下:
from cx_Freeze import setup, Executable, sys
exe=Executable(
script="XYZ.py",
base="Win32Gui",
)
includefiles=[]
includes=[]
excludes=[]
packages=[]
setup(
version = "1.0",
description = "XYZ",
author = "MAX",
name = "AT",
options = {'build_exe': {'excludes':excludes,'packages':packages,'include_files':includefiles}},
executables = [exe]
)
from distutils.core import setup
import py2exe, sys, os, difflib
sys.argv.append('py2exe')
setup(
options = {'py2exe': {'bundle_files': 1}},
console = [{'script': "XYZ.py"}],
zipfile = None,
)
获取的exe运行时,弹出错误提示:
...
File "C:\Python34\Lib\site-packages\win32com\client\CLSIDToClass.py", line 46, in GetClass
return mapCLSIDToClass[clsid]
KeyError: '{00020970-0000-0000-C000-000000000046}'
我只是无法解决这里的问题。请帮忙。
谢谢。
【问题讨论】:
-
你的
win32com.client代码使用静态代理吗? -
@Fenikso 我没明白....什么是静态代理....?我只是从 word 文档中读取一些内容,为此我在我的脚本 XYZ.py 中使用 import win32com.client ...
-
如果您不知道它是什么,您可能正在使用
EnsureDispatch。它自动生成静态代理。它有一些好处,但它可能会破坏 cx_freeze。尝试改用Dispatch。见timgolden.me.uk/python/win32_how_do_i/…。 -
也尝试了 Dispatch....抛出错误...'module'对象没有属性'Dispatch'...我也使用了 py2exe...但同样的错误再次... .thnks
-
你试过
win32com.client.Dispatch或win32com.client.dynamic.Dispatch吗?
标签: python-3.x exe cx-freeze win32com