mac 上的 XlWings 错误与平行线

Error with XlWings on mac with parallels

我尝试使用来自 Parallels 的 Microsoft Excel 在 mac 上打开斐波那契模板,但出现以下错误(xlwings 版本 0.4.1)。 文件用微软自动打开很好 Excel 错误来了

有人知道如何纠正吗?

In[39]: wb = Workbook(r'/Users/Downloads/fibonacci.zip Folder/fibonacci.xlsm')
Traceback (most recent call last):
  File "/Users/anaconda/lib/python2.7/site-   packages/IPython/core/interactiveshell.py", line 3035, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-39-8750713fa323>", line 1, in <module>
wb = Workbook(r'/Users/Downloads/fibonacci.zip Folder/fibonacci.xlsm')
  File "/Users/anaconda/lib/python2.7/site-packages/xlwings/main.py", line 158, in __init__
self.name = xlplatform.get_workbook_name(self.xl_workbook)
  File "/Users/anaconda/lib/python2.7/site-packages/xlwings/_xlmac.py", line 102, in get_workbook_name
return xl_workbook.name.get()
  File "/Users/anaconda/lib/python2.7/site-packages/aeosa/appscript/reference.py", line 498, in __call__
raise CommandError(self, (args, kargs), e, self.AS_appdata)
CommandError: Command failed:
    OSERROR: -1708
    MESSAGE: Application could not handle this command.
    COMMAND: app(u'/Users/Applications (Parallels)/{716d2333-63ae-4f42-a203-ae81a0a171db} Applications.localized/Microsoft Excel.app').workbooks['fibonacci.xlsm'].name.get()

如果您想通过 Parallels 使用来自 Mac 的 Excel 的 Windows 版本,您需要从基于 Windows 的 Python 驱动程序安装(例如从 Windows 命令提示符而不是 Mac 终端)。

如果您想要驱动 Mac Excel 2011 或 2016,以防 Parallels 给您带来困难,请指定 Mac Excel 的路径通过 app_target 安装,参见 docs or this question.