为什么将 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 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
您可能在您的应用程序中使用了一个名为 xlwings
的包,该包专为在 Windows 和 Mac 上使用而构建,但 Heroku 上的服务器已安装 linux在它们上面,因此您首先必须将环境变量 INSTALL_ON_LINUX
设置为 1
,然后再次尝试部署该应用程序。
您可以从 Heroku CLI 执行以下操作:
heroku config:set INSTALL_ON_LINUX=1
我只是想将我的 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 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
您可能在您的应用程序中使用了一个名为 xlwings
的包,该包专为在 Windows 和 Mac 上使用而构建,但 Heroku 上的服务器已安装 linux在它们上面,因此您首先必须将环境变量 INSTALL_ON_LINUX
设置为 1
,然后再次尝试部署该应用程序。
您可以从 Heroku CLI 执行以下操作:
heroku config:set INSTALL_ON_LINUX=1