我刚刚在 MacOS 10.10.2 上安装了 xlwings。它适用于 python 2.7,但我无法让它与 3.4 一起运行。我尝试了 pip 和 conda 安装。
在 IDLE 3.4 上,我什至无法导入 xlwings。我收到一条错误消息,指出该模块不存在。
在 IDLE 2.7 上,我可以导入 xlwings,但是当我运行时
>>> wd = Workbook()
我收到以下错误:
Traceback (most recent call last):
File "<pyshell#10>", line 1, in <module>
wd = Workbook()
File "/Library/Python/2.7/site-packages/xlwings/main.py", line 141, in __init__
self.xl_app, self.xl_workbook = xlplatform.new_workbook()
File "/Library/Python/2.7/site-packages/xlwings/_xlmac.py", line 117, in new_workbook
xl_workbook = xl_app.make(new=kw.workbook)
File "/Library/Python/2.7/site-packages/aeosa/appscript/reference.py", line 462, in __call__
return self.AS_appdata.target().event(self._code, params, atts, codecs=self.AS_appdata).send(timeout, sendflags)
File "/Library/Python/2.7/site-packages/aeosa/aem/__init__.py", line 189, in event
codecs or self._codecs, self._createproc, self._sendproc)
File "/Library/Python/2.7/site-packages/aeosa/aem/aemsend.py", line 54, in __init__
self.AEM_event.setparam(key, codecs.pack(value))
File "/Library/Python/2.7/site-packages/aeosa/appscript/reference.py", line 273, in pack
raise ValueError("Unknown Keyword: k.%s" % data.AS_name)
ValueError: Unknown Keyword: k.workbook
我完全陷入困境......我有两个版本的 Excel,2011 和 2016。Excel 2016 是我的默认应用程序。我不知道这是否对 xlwings 有影响。