繁体   English   中英

Heroku 部署 Dash 应用程序时出现应用程序错误:“OSError:xlwings 需要安装 Excel,因此仅适用于 Windows 和 macOS。”

[英]Heroku application error when deploying Dash app: "OSError: xlwings requires an installation of Excel and therefore only works on Windows and macOS."

当我尝试将 Dash 应用程序部署到 Heroku 时出现错误。

这是我第一次使用 Heroku 和 Dash 以及 Plotly。我正在尝试为我的团队部署这个应用程序。 我没有在 GitHub 上保存代码。我得到的错误是“无法将一些引用推送到...”

完整的问题如下所示。

remote:        Collecting xlwings==0.20.4
remote:          Downloading xlwings-0.20.4.tar.gz (647 kB)
remote:            ERROR: Command errored out with exit status 1:
remote:             command: /app/.heroku/python/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-pamtz4zz/xlwings/setup.py'"'"'; __file__='"'"'/tmp/pip-install-pamtz4zz/xlwings/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-jxny1ijq
remote:                 cwd: /tmp/pip-install-pamtz4zz/xlwings/
remote:            Complete output (5 lines):
remote:            Traceback (most recent call last):
remote:              File "<string>", line 1, in <module>
remote:              File "/tmp/pip-install-pamtz4zz/xlwings/setup.py", line 32, in <module>
remote:                raise OSError("xlwings requires an installation of Excel and therefore only works on Windows and macOS. To enable the installation on Linux nevertheless, do: export INSTALL_ON_LINUX=1; pip install xlwings")
remote:            OSError: xlwings requires an installation of Excel and therefore only works on Windows and macOS. To enable the installation on Linux nevertheless, do: export INSTALL_ON_LINUX=1; pip install xlwings
remote:            ----------------------------------------
remote:        ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
remote:  !     Push rejected, failed to compile Python app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !   Push rejected to dash.
remote: 
To https://git.heroku.com/dash.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/dash.git'

xlwings 需要安装 Excel,因此仅适用于 Windows 和 macOS

Heroku 不运行 Windows 或 macOS(它运行 Linux),因此您不能在xlwings上使用 xlwings。

设置INSTALL_ON_LINUX=1绕过此检查并让安装继续进行,但它不会改变 Heroku 正在运行 Linux 而不是 Windows 或 macOS 的事实,并且它当然不提供 Excel。

也许您对xlwings工作原理感到困惑? 您可能在本地运行 Windows 或 macOS,并且很可能有 Excel 可用。 但是你部署到 Heroku 的代码在那里运行,并且无法访问你机器上的 Excel。

您可能想通读客户端编程和服务器端编程有什么区别? 您部署到 Heroku 的代码在服务器端运行。

我不知道你想用 Excel 做什么,但还有其他 Excel 库可用于 Python。像openpyxl这样的东西可能会在你的应用程序中取代xlwings 它应该在 Heroku 上运行。

但它可能不会做你想做的事xlwings可以做一些openpyxl做不到的巧妙的事情。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM