簡體   English   中英

為什么將 Flask 應用程序推送到 Heroku 失敗?

[英]Why did push of a Flask app to Heroku failed?

我只是想將 Flask 應用程序推送到 Heroku,但遇到以下錯誤:

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-qq0uk569/xlwings/setup.py'"'"'; __file__='"'"'/tmp/pip-install-qq0uk569/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-dxixzzkg
remote:                 cwd: /tmp/pip-install-qq0uk569/xlwings/
remote:            Complete output (5 lines):
remote:            Traceback (most recent call last):
remote:              File "<string>", line 1, in <module>
remote:              File "/tmp/pip-install-qq0uk569/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 browebgen.
remote: 
To https://git.heroku.com/browebgen.git
 ! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/browebgen.git'

我不確定我需要做什么才能擺脫這個錯誤。

錯誤消息說明了一切:

xlwings 需要安裝 Excel,因此僅適用於 Windows 和 macOS。 盡管如此,要在 Linux 上啟用安裝,請執行: export INSTALL_ON_LINUX=1; pip 安裝 xlwings

您可能在您的應用程序中使用了一個名為xlwings的包,該包是為在 Windows 和 Mac 上使用而構建的,但 Heroku 上的服務器上安裝了 linux,因此您首先必須將環境變量INSTALL_ON_LINUX設置為1然后嘗試部署再次應用。

從 Heroku CLI,您可以執行以下操作:

heroku config:set INSTALL_ON_LINUX=1 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM