如何让 python 中的 Zxing 与 Heroku 一起工作?

How to get Zxing in python working with Heroku?

我正在向 heroku 部署一个 python flask 应用程序,它使用 Zxing 读取二维码(扫描它们)并给出上面的数据,但是 Zxing 需要 Java 在 heroku 环境中。

子兴 : https://github.com/dlenski/python-zxing

Zxing 出错

barcode = reader.decode(f) #qrreader.data#
File "/app/.heroku/python/lib/python3.6/site-packages/zxing/__init__.py", line 48, in decode
raise BarCodeReaderException("Java binary specified does not exist", self.java, e)
zxing.BarCodeReaderException: ('Java binary specified does not exist', 'java', FileNotFoundError(2, "No such file or directory: 'java'"))

我试过的

将 java buildpack 添加到 python 旁边的环境中,但会出现错误,我不确定它是否能以任何一种方式解决问题。

来自 heroku 的 Java buildpack

heroku/java

寻找仅需 python(找到 none)(zbar 依赖性问题)就可以完成相同工作的其他库

我当前的构建包

https://github.com/survantjames/heroku-buildpack-poppler.git
heroku/python
https://github.com/heroku/heroku-buildpack-apt

所有这些都适用于本地 windows 10 环境,安装了 java,没有其他更改。

有没有办法让 Zxing 正常工作或者有其他可行的方法?

谢谢:D

编辑: Java 构建错误详细信息。(无关紧要,检查下面的答案)

Rewrite package-config files
remote: -----> JVM Common app detected
remote: -----> Installing JDK 1.8... done
remote: -----> Java app detected
remote: -----> Using provided JDK
remote: -----> Installing Maven 3.6.2... done
remote: -----> Executing Maven
remote:        $ mvn -DskipTests clean dependency:list install
remote:        [INFO] Scanning for projects...
remote:        [ERROR] [ERROR] Some problems were encountered while processing the POMs:
remote:        [ERROR] 'modelVersion' is missing. @ line 1, column 9
remote:        [FATAL] 'groupId' is missing. @ line 1, column 9
remote:        [FATAL] 'artifactId' is missing. @ line 1, column 9
remote:        [FATAL] 'version' is missing. @ line 1, column 9
remote:         @
remote:        [ERROR] The build could not read 1 project -> [Help 1]
remote:        [ERROR]
remote:        [ERROR]   The project [unknown-group-id]:[unknown-artifact-id]:[unknown-version] (/tmp/build_7e2d7b50/pom.xml) has 4 errors
remote:        [ERROR]     'modelVersion' is missing. @ line 1, column 9
remote:        [ERROR]     'groupId' is missing. @ line 1, column 9
remote:        [ERROR]     'artifactId' is missing. @ line 1, column 9
remote:        [ERROR]     'version' is missing. @ line 1, column 9
remote:        [ERROR]
remote:        [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
remote:        [ERROR] Re-run Maven using the -X switch to enable full debug logging.
remote:        [ERROR]
remote:        [ERROR] For more information about the errors and possible solutions, please read the following articles:
remote:        [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
remote:
remote:  !     ERROR: Failed to build app with Maven
remote:        We're sorry this build is failing! If you can't find the issue in application code,
remote:        please submit a ticket so we can help: https://help.heroku.com/
remote:
remote:  !     Push rejected, failed to compile Java app.
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !       Push rejected to invoice-parser.

我已经通过添加构建包解决了我的错误

https://github.com/heroku/heroku-buildpack-jvm-common.git

代替 java buildpack( EDIT: heroku/java) heroku 提供的 buildpack 我我只使用了将 jvm 安装到我的环境 EDIT: 这也是由 heroku 提供并在 link.[=12= 中提到的]

Zxing 现在构建良好:D

编辑: 由于我写的不好而造成混乱,但我一点也不意味着 heroku 不提供这些构建包。我在这里说“到位”应该在问题的上下文中进行,因此它代替了原始的构建包(heroku/java)。它在任何地方或形式都意味着 heroku 不提供构建包。

感谢指出困惑