我正在尝试将我的第一个 Plotly Dash 应用程序(用 Python 编写)部署到 Heroku。我无法捆绑所有软件包来编译应用程序,目前使用的是 Python-javabridge。
当我尝试部署我的应用程序时,即使从 中删除 python-javabridge 后requirements.txt
,它仍然会尝试捆绑它,给我以下错误:
remote: Collecting jeepney>=0.4.2; sys_platform == "linux"
remote: Downloading jeepney-0.6.0-py3-none-any.whl (45 kB)
remote: Collecting importlib-resources; python_version < "3.7"
remote: Downloading importlib_resources-4.1.1-py3-none-any.whl (22 kB)
remote: Collecting python-javabridge==4.0.0
remote: Downloading python-javabridge-4.0.0.tar.gz (1.3 MB)
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-qllzoihk/python-javabridge/setup.py'"'"'; __file__='"'"'/tmp/pip-install-qllzoihk/python-javabridge/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-xeh4coov
remote: cwd: /tmp/pip-install-qllzoihk/python-javabridge/
remote: Complete output (11 lines):
remote: Traceback (most recent call last):
remote: File "<string>", line 1, in <module>
remote: File "/tmp/pip-install-qllzoihk/python-javabridge/setup.py", line 412, in <module>
remote: ext_modules=ext_modules(),
remote: File "/tmp/pip-install-qllzoihk/python-javabridge/setup.py", line 96, in ext_modules
remote: java_home = find_javahome()
remote: File "/tmp/pip-install-qllzoihk/python-javabridge/javabridge/locate.py", line 133,
in find_javahome
remote: java_bin = get_out(["bash", "-c", "type -p java"])
remote: File "/tmp/pip-install-qllzoihk/python-javabridge/javabridge/locate.py", line 130,
in get_out
remote: raise Exception("Error finding javahome on linux: %s" % cmd)
remote: Exception: Error finding javahome on linux: ['bash', '-c', 'type -p java']
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
我做了什么:
只是运行pip install javabridge
完美,没有问题。
我添加JAVA_HOME
到我的系统变量和路径中,没有帮助。在 cmd 上写入javac
或java --version
按预期输出版本。
我使用 Windows 10、Python 3.7、Anaconda3、Spyder 终端来运行命令。