xlwings runpython 安装失败

xlwings runpython install fails

我正在尝试在 mac (10.11.5) 上使用 xlwings,在 Excel 2016 上使用 Mac(版本 15.23.2),但我很快就卡住了。

当我运行 xlwings 运行python 安装 我收到以下错误:

$ xlwings runpython install
Traceback (most recent call last):
  File "/usr/local/bin/xlwings", line 7, in <module>
    from xlwings.command_line import main
  File "/Library/Python/2.7/site-packages/xlwings/command_line.py", line 22, in <module>
    hfs_to_posix_path(app('Microsoft Excel').properties().get(k.templates_path))))
  File "/Library/Python/2.7/site-packages/aeosa/appscript/reference.py", line 577, in __getattr__
    selectortype, code = self.AS_appdata.referencebyname()[name]
  File "/Library/Python/2.7/site-packages/aeosa/appscript/reference.py", line 259, in referencebyname
    self.connect()
  File "/Library/Python/2.7/site-packages/aeosa/appscript/reference.py", line 225, in connect
    t = self._target = self._aemapplicationclass(**kargs)
  File "/Library/Python/2.7/site-packages/aeosa/aem/__init__.py", line 76, in __init__
    self._address = aemconnect.localapp(path, newinstance, hide)
  File "/Library/Python/2.7/site-packages/aeosa/aem/aemconnect.py", line 187, in localapp
    desc = _launchapplication(path, _runevent, newinstance, hide)
  File "/Library/Python/2.7/site-packages/aeosa/aem/aemconnect.py", line 55, in _launchapplication
    raise CantLaunchApplicationError(err.args[0], path)
aem.aemconnect.CantLaunchApplicationError: Can't launch application at u'/Applications/Microsoft Excel.app': The executable file is missing or has an unusable format. (-10827)

关于如何进行的任何想法?

版本: Python 2.7.10 xlwings (0.7.2) psutil (4.3.0) 附加脚本 (1.0.1)

不太确定 为什么 它失败了,但是 xlwings runpython install 试图做的,只是从 xlwings 安装目录复制 xlwings.appscript 文件进入以下目录:~/Library/Application Scripts/com.microsoft.Excel。因此,要解决此问题,您只需手动将文件复制到该目录(如果目录尚不存在,则创建该目录)。您将通过以下操作找到 xlwings 安装的路径:

>>> import xlwings as xw
>>> xw.__path__

我发现了问题: 基本上,我 运行 xlwings runpython install 在与 Excel 不同的用户环境中。