如何解决特定于python3.8.0的Heroku构建错误

2024-03-28 22:34:56 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在通过命令行将一个Python(flask)应用程序部署到Heroku,在运行时指定python3.8.0之后,我遇到了一个与'\u ast27'扩展相关的错误,我不知道该怎么办。你知道吗

如果我使用python3.6.9构建应用程序,它工作正常,没有错误。你知道吗

当我添加运行时.txt文件指定python-3.8.0时,我在生成过程中遇到错误,生成失败(错误:命令'gcc'失败,退出状态为1)。你知道吗

卸下runtime.txtfile文件使用python3.6.9构建解决了这个问题,但是由于安全更新,我更喜欢使用3.8.0。你知道吗

以下是日志的两个相关部分:

building '_ast27' extension
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/ast27
creating build/temp.linux-x86_64-3.8/ast27/Parser
creating build/temp.linux-x86_64-3.8/ast27/Python
creating build/temp.linux-x86_64-3.8/ast27/Custom
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -Iast27/Include -I/app/.heroku/python/include/python3.8 -c ast27/Parser/acceler.c -o build/temp.linux-x86_64-3.8/ast27/Parser/acceler.o
           ast27/Parser/acceler.c:13:10: fatal error: pgenheaders.h: No such file or directory
#include "pgenheaders.h"
^~~~~~~~~~~~~~~
compilation terminated.
error: command 'gcc' failed with exit status 1
Command "/app/.heroku/python/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-i8bnpa9v/typed-ast/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-aq2n5sd0-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-i8bnpa9v/typed-ast/
 !     Push rejected, failed to compile Python app.

我承认我不明白ast是什么,或者它是用来干什么的。到目前为止,我在google上所做的搜索还没有发现任何与pythom 3.8.0相关的具体内容,因此我非常感谢您的建议。你知道吗

谢谢!你知道吗


Tags: buildcreatingappparserlinux错误errortemp